MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

Merge async and not-async implementation

Open shps951023 opened this issue 1 year ago • 6 comments

shps951023 avatar May 18 '24 01:05 shps951023

What do you mean by this? Maybe I can help

duszekmestre avatar May 20 '24 08:05 duszekmestre

@duszekmestre ❤thanks, e.g. ExcelOpenXmlSheetWriter.Async.cs and ExcelOpenXmlSheetWriter.cs, their logic and code 99% same, but miniexcel needs duplicate code to use async, Task, await keyword. I think these code can be merged.

shps951023 avatar May 20 '24 09:05 shps951023

Yes - I tried to do this but I have limited time for doing this. Some code can be reused and in latest PR i refactor one of the method to prepare string values to write them to the writer.

duszekmestre avatar May 20 '24 09:05 duszekmestre

I started to reuse code in PR #602

In the next part I'll try to reuse code between different types of objects on saving.

duszekmestre avatar May 20 '24 22:05 duszekmestre

@duszekmestre ❤thanks, e.g. ExcelOpenXmlSheetWriter.Async.cs and ExcelOpenXmlSheetWriter.cs, their logic and code 99% same, but miniexcel needs duplicate code to use async, Task, await keyword. I think these code can be merged.

I think it is not possible to completely reuse same code. Async/await method should be written separately. The only thing which is possible is creating same codebase to generate XML strings for both implementations to reuse and easier maintenance.

I saw that different types (data reader, data table, enumerable) are managed separately so many errors are done because of lack of implementation to one of them. This the hardest and most important thing to rewrite.

If you have any other idea please share with me.

duszekmestre avatar May 20 '24 23:05 duszekmestre

Yes, my first idea is we can only maintain async method like HttpClient sync method just call async method GetAwaiter and GetResult

shps951023 avatar May 23 '24 11:05 shps951023

Image

You said please issue for me so here it is 😊

I cannot get merge to work at all btw. I only tried the async version because I was running out of ideas to get the normal one to work.

It lets me download the excel, but the excel is corrupt. I tried many many things including removing the other non-merge fields, wrapping all rows instead of just per section that should merge.

fpt-ian avatar Feb 10 '25 10:02 fpt-ian

@fpt-ian If you're still experiencing this problem could you please create a new issue and attach the file that you're not able to work with?

michelebastione avatar Mar 20 '25 18:03 michelebastione