salvois / LargeXlsx

A .net library to write large Excel files in XLSX format with low memory consumption using streamed write.
Other
204 stars 34 forks source link

MemoryStream supported? #48

Closed andreiTeodorescu97 closed 5 months ago

andreiTeodorescu97 commented 5 months ago

Is the FileStream a constraint to use XlsxWriter? Is a MemoryStream supported to generate an xlsx file?

dgosbell commented 5 months ago

The constructor for XlsxWriter takes an abstract Stream (see https://github.com/salvois/LargeXlsx/blob/7443a933c0e0052da668c2f8de8ee148fa957047/src/LargeXlsx/XlsxWriter.cs#L59) and MemoryStream is a subclass of Stream just like FileStream is so it should work fine.

salvois commented 5 months ago

Hi @andreiTeodorescu97 , following up @dgosbell comment (thanks!), you an use any Stream implementation, including MemoryStream. In fact, you can find it used in this very repository, in the unit tests. Thanks, Salvo