As mentioned in previous post we were excited by the introduction of the new TOC generation feature in Aspose and were looking forward to putting it to good use. However we have run in to some serious performance issues that presently will result in dumping what otherwise would be a great feature.
The attached large document report ‘Testin.docx’ was generated and saved to disc as part of our report generating process within 20 seconds using the latest Words Aspose 9.0.
The performance problems start however once we add code to generate the TOC. For example running the following simple code on the attached document produces the following results:
Document doc = new Document(@"TestIn.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
Debug.Write(DateTime.Now + " START UPDATE FIELDS\n");
builder.Document.UpdateFields();
Debug.Write(DateTime.Now + " START UPDATE PAGE LAYOUT\n");
builder.Document.UpdatePageLayout();
Debug.Write(DateTime.Now + " START SAVE\n");
builder.Document.Save(@".\Testout.docx");
13/05/2010 18:10:19 START UPDATE FIELDS
13/05/2010 18:11:01 START UPDATE PAGE LAYOUT
13/05/2010 18:11:31 START SAVE
It takes 42 seconds to update the fields and then another 30 seconds to update the page layout. This results in adding 72 seconds to report generation just for the sake of adding a TOC. Remember original report only takes 20 to build and save.
(Note: For Comparison it does takes Microsoft Word approx 25 seconds to update the TOC in this document.)
Therefore can Aspose advise on any of the following:
- Is there anyway of speeding up the TOC generation process?
- I tried calling UpdateFields on the Paragraph.Range that contained the TOC but this did not seem to work and the TOC was not updated?
- What is going on whithin Update Fields/Update Page Layout that takes so long? Is there anyway I could change my document styles TOC definition that would speed up this process?
- Are aspose aware of this problem? Are there any plans in progress to improve the performance of this feature?
Thanks and Regards
Daniel Finkelstein
Senior Software Engineer - HP Software