EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
280 stars 50 forks source link

Option to save to Stream rather than file path #38

Closed hisuwh closed 1 year ago

hisuwh commented 1 year ago

I am developing a web application and want to be able to generate a word document to then be downloaded by the user.

This library does not give me the option to save to a Stream only a file path

hisuwh commented 1 year ago

Actually I've realised the underlying document object is public so I can do this

var resultStream = new MemoryStream();
document._wordprocessingDocument.Clone(resultStream);
resultStream.Seek(0, SeekOrigin.Begin);

Might be nice to have a first class method though?

PrzemyslawKlys commented 1 year ago

Feel free to do PR? I would be more than happy to accept this as an improvement

hisuwh commented 1 year ago

Here you go: https://github.com/EvotecIT/OfficeIMO/pull/43

PrzemyslawKlys commented 1 year ago

@hisuwh Tests are failing tho?