We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Memory management when combining many documents

Hi Adam,

We’re using aspose to implement a server side mail merge in our product. When we do a merge we append all merged data (1 doc per record) into a final doc so it can be opened and printed off. So obviously we’re prone to out of memory errors with this approach (bur we must produce 1 document with all merged records – business rules), We can check the memory after each append so we only keep appending if there is enough memory left.

Then when saving the file to disk we set the ‘TempFolder’ on the saveoption so it should use the temp folder rather than memory for saving. Is there a way to calculate how much memory the save still needs when using the temp folder? I appreciate it really depends on the data and the document itself but if you have any guideline it would be greatly appreciated.



This message was posted using Email2Forum by aske012.

Hi Eamonn,

Thanks for your inquiry.

Please note that the temp folder currently only takes affect when saving in the DOC format, it is not used for the other formats yet. Therefore if you are saving in another format such as DOCX then this would be the reason for OutOfMemory exception.

If you are saving as DOC then optimally you shouldn’t run into an exception during save. Please clarify if this is the case.

I’m afraid there is no direct way to find how much memory is still required. However you could gather a general indication of how much space a save would require by saving a fragment of the document (one of the parts that are appended) and seeing how large the output is. If you multiply this by the number of documents appended this would give a general indication of how much space is required.

If we can help you with anything else, please feel free to ask.


Hi Adam,

We are experiencing the exact same problem.

Saving the combined docx files to doc and setting a temp folder solves the problem.

Can you tel us when this wil be resolved for saving to docx?

We explicitly have chosen aspose for its ability to process docx files, saving the files to doc is not an option for the long term.

Kind Regards,

Richard Scholten

Hi Richard,

Thanks for your inquiry.

I have added your request for this feature to our internal database. We will inform you as soon as there are any developments.

I’m afraid there is no ETA yet, I hope for the mean time saving in DOC format will be suitable for you at least.


Hi Richard, Eamonn,

I have some news about your issue. During some testing I happened to find that this functionality is already available in Aspose.Words 11.1.0. It seems it was silently added to a recent version without any formal feature tracking.

Please try setting this temporary folder when exporting to DOCX and inform me of how it goes. I apologise for the delay that there was informing both of you about this option.


Thats great news.

Wil download the latest version and try this.



Works like a charm

In case anyone is wondering, use OoxmlSaveOptions for docx… ( SaveOptions so = new OoxmlSaveOptions(); )

thank you for the support.



Nice one, thanks for that.



The issues you have found earlier (filed as WORDSNET-6018) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.