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

Add method to create a document in Stream #47

Open rstm-sf opened 1 year ago

rstm-sf commented 1 year ago

At the moment, it is not possible to set the Stream into which the document will be saved. This is convenient when we do not want to save the file locally, but only generate it in memory.

PrzemyslawKlys commented 1 year ago

Wasn't it added already in 0.3.0

rstm-sf commented 1 year ago

Oops didn't see it. Thank you. This issue is a little different, here is a request to use the passed stream

PrzemyslawKlys commented 1 year ago

You're asking to add, or willing to add yourself ? :-)

rstm-sf commented 1 year ago

Thinking to add :)

rstm-sf commented 1 year ago

At the moment, the current issue rests on the fact that when cloning a document, the document itself is saved, despite the fact that AutoSave equal false https://github.com/OfficeDev/Open-XML-SDK/issues/1139

* [Implement Save and Load to/from Stream #43](https://github.com/EvotecIT/OfficeIMO/pull/43)

By the way, this change suffers from the same problem

PrzemyslawKlys commented 1 year ago

We actually fixed this in https://github.com/EvotecIT/OfficeIMO/pull/16 as far as I remember. We had same issue, but so far the original document after load should not be changed?

rstm-sf commented 1 year ago

The problem remains with the document that is in memory, its state changes each time

https://github.com/EvotecIT/OfficeIMO/blob/e965a042489a79aa04f630aaf6bb186a3b8284c8/OfficeIMO.Word/WordDocument.cs#L364

or

https://github.com/EvotecIT/OfficeIMO/blob/e965a042489a79aa04f630aaf6bb186a3b8284c8/OfficeIMO.Word/WordDocument.cs#L482-L486