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

Free Support Forum - aspose.com

OutofMemory Exception when trying to create large Docx file

Our company is creting a product where we need to create a report which can go upto 10-15 thousand pages in Word Format. For testing preformance i tired to create a dummy report through Aspose but its giving system.outofmemeory exception. Code works fine if i try to generate small document.
This is could be a great problem for us as our new product will be mainly used for reporting where we can have large reports and event we have to merge large doucments. This problem is even coming when i try to merge 2 word documents.
I am attaching my sample code. Please try to take my request on priority as i have to demo it to the management and i had no clue that aspose will fail to generate large document.
We need to generate 10,000 page of word document(docx) as benchmark for the product.
In the attached code to increase or decrease the number of data rows please change the following line of code in Template.cs file
line no 751
for (int index = 0; index < 590; index++)
Please change the license path in follwoing file
Enviornment Desc
Windows 2003 Dual CPU, 4 GB RAM. Using Aspose.Words

Thanks for your inquiry. Memory consumption depends on the documents that are being processed. Usually Aspose.Words needs about 10 times more memory for building the model than the source document size.
The document contains 1500 pages has size 50Mb so it takes 500Mb or more of RAM to open or generate this document using Aspose.Words. your document is much larger so it takes more memory.
I don’t think that building huge document is good idea. MS Word also works not well with huge documents. (just try to create so big document using MS Word).
So I would advice using few small documents instead one huge document.
Best regards.

Thanks for your response. I totally agree with your point but the problem is generating 5000 to 10,000 page of document is part of our requirement. As our product deals with reporting Adverse Event data to Regulatory Agencies(FDA,EMEA) data is huge.
Can incresaing the memory help in generating the large word document? I already have 4 GB of RAM. If u suggest i can increase it further. One intresting thing that i noticed, I was able to create upto 8000 page of document in DOC format but only upto 3500 page of document in DOCX format.
I liked the advice which you mentioned about creating small document instead of one huge document but is there way in aspose that after breaking say Report1 into 3 Reports Report1 Report2 and Report3 i can just merge them into one single docuemnt. The idea is that before submitting the report to regulatory agency(as i mentioned earlier) Client reviews the whole document. So they need 1 single document which they can review.

Thanks for your inquiry.

  1. Most probably increasing of RAM could solve the problem. But I don’t think this is good solution.
  2. If you generate few small reports and then merge these reports together you will get the same problem as if you generate one huge report.
    Best regards.