Dear Sir or Madam,
I build a document by writing directly to the DOM. The document contains pretty few sections and it takes 2 minutes to achieve the task on my laptop. Recently I was asked to add page numbers in the document. As I do not use DocumentBuilder I did it using a workaround:
For each section inserted in the document I go to the last paragraph of footers of last section and add the field:
DocumentBuilder documentBuilder = new DocumentBuilder(mOutputDocument); documentBuilder.MoveTo(mOutputDocument.LastSection.HeadersFooters[footerType].LastParagraph);
documentBuilder.InsertField(fieldBody);
The document processing time increased from 2 minutes to 10(!) minutes. I tried to use a different approach: enumerate through all the sections in the output document and add page numbers in each section but it took even longer. Is there any way I can speed up the page numbers insertion? Document in attach is the one I try to build.