Issue with saving to PDF

I’m creating a document on the fly. It has nested tables (master / two detail sections). The document successfully saves to PDF with small datasets (less then 100 rows at the master level). My worst case document has 3,400 master rows and about 10,000 rows between two detail sections. The application uses one master word template and each detail section is a word document as well. As the master document is populated and a detail section is encountered, the detail word doc is populated and inserted into the master word doc.
When I try to save to PDF, I get a stackoverflow exception. I am able to save the document to Word and open it.
I’m using Aspose.Words 8.0 and issuing doc.Save with a .PDF file name. I have attached the generated word doc as well as the templates I’m using in my application.


Thanks for your request. Your document is too huge and there are too many nested tables in it. It takes few minutes to open this document in MS Word and 20 minutes or more to scroll the document to the end. The document contains 1986 pages! This is too many. I think, in your case, it is better to use few smaller documents instead of one huge document.
Also, I think, you should change structure of your document to reduce nesting of tables.
Best regards.

I can not split this document into seperate docs. How can I ensure that this document is saved to PDF? What are my limiting factors (# of pages, table nesting etc…)? I can easily reduce the page count by reducing the spacing between rows. Would that resolve the issue?
How can I retain formatting without using tables? Is there another option?
Is it possible to save the word document into PDF in chunks? Example, if over 1000 pages then save first 200, then next 200 etc… and then merge into a single PDF?


Thank you for additional information. I do not think that reducing the spacing between rows will help you to resolve this problem. Your document is still too huge. As you can see MS Word also does not like such huge document very much.
Unfortunately, the only way to resolve the problem, I can suggest you at the moment, is using few smaller documents instead one huge. Then after converting document to PDF, you can try using Aspose.Pdf.Kit to concatenate documents into one PDF.
Best regards.