Free Support Forum -

Repeated opening/closing causes Word to crash

Hey Roman,

Am trying to use Aspose to assemble a “master” document from several smaller templates depending on input, inserting pictures based on input, and then performing a merge on that master.

Everything was working fine, and the master-merged file could be opened in Word (2003), and printed. BUT…

It could not be re-saved (SaveAs) or altered in any way. To do so would cause Word to go into what appears to be a continuous loop (100% processor, no change in memory usage) for ever (at least more than 30 minutes – that’s as long as I let it run).

At first I thought it was the merge, as others have posted about Word crashing after a merge. But then I realized that the pre-merge document was also crashing. So after some fiddling, I found that it appears to be in the number of times Aspose is required to open and re-save a document. For example:

My routine starts with a blank file, “report.doc” – then, for each file needing to be added, I used:

while (srcDoc.Sections.Count > 0)
Section section = srcDoc.Sections[0];

and re-saved destDoc after each addition. There are between 20 and 30 additions per master document. Then, for each picture, I added:

System.Drawing.Image image = System.Drawing.Image.FromFile(“c:…\”<a target="_blank" title="‘file://\"+Request.Params["filename’" href="‘file://\"+Request.Params["filename’">+Request.Params[“filename”]);

and re-saved the document.

Between the assembly and the pictures, I had Aspose opening and re-saving the document probably 50 times or better.

To test, I created a “master” file manually by assembling the various parts with copy/paste. Then, I let Aspose put the pics in automatically, reducing the number of open/saves by about half.

This alone resulted in a “master” document that works fine in Word, both before and after the merge.

So, I am planning on re-doing my process to open and insert all parts at once prior to closing, and then opening and inserting all pics at once before closing, drastically reducing the number of times Aspose will have to go through the process.

Apparently there is something in docbuilder that does not like to repeatedly open, change, and re-save a document. I post to make you aware of this, and to let other know that reducing the number of open/saves might help.

Thanks again for a great product. I am now almost to a workable solution, and look forward to my purchase.


Thanks for the report, we will have this investigated and fixed, but problems like this do take some time to fix. It could be 1-2 weeks.