Document streaming

Good day!

We use Aspose.Words for merging documents. And have a question about is there any way to work directly to file (document streaming)? i.e. we have 1500 records to merge and we should merge this records into single file (doc, pdf), to get aim we should create new “parent” document and append every new merged document to it (parent) and only then save this parent document to disc, but for ex. template size is 2 MB and the result document is too large (~ 3 gigs per user!) to store it into memory and we don’t need it!

Do you have any ideas? Thanx.

Guys? We really need it.

Hi,

Thanks for your inquiry. Yes, you can merge/join documents after performing the mail merge operaion. You need to save document into memeory as shown in following code snippet.

MemoryStream stream = new MemoryStream();
Document doc = new Document(MyDir + "in.docx");
// Your mail merge code...
doc.Save(stream, SaveFormat.Docx);

In terms of memory, If you are loading huge Word documents into Aspose.Words’ DOM, more memory would be required. This is because during processing, the document needs to be held wholly in memory. Usually, Aspose.Words needs 10 times more memory than the original document size to build a DOM in the memory. It is better to use few small documents instead of one huge document.
Hope this answer your query. Please let us know if you have any more queries.