Page numbers are not updated properly in TOC

Hi there!


We just noticed that the page numbers in TOC are not updated properly until we “update” it in the resulting DOCX.

This occurs in certain situations. I’ve attached and sample project in which I’ve been able to reproduce the problem.

The sample project generates a DOCX document and a PDF document. The PDF seems to be OK.
The version of Aspose.Words we use is 11.10.

Is there a way we can “force” an extra update before saving? I already call UpdateFields and UpdatePageLayout() before saving the document…

Best regards,

JSr

Hi JSr,


Thanks for your inquiry. Please note that a Word document may contain one or more sections. At the end of the section, there is a section break that separates one section from the next in a document. Each section has its own set of properties that specify page size, orientation, margins, the number of text columns, headers and footers and so on.

I would suggest you please read the following documentation links for your kind reference.

I am working over your shared project and will update you asap.

Hi JSr,


I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-8077 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thank you for the quick support, once again!


So no possible workaround with the aspose.words version we have actually (11.10) ?

Best regards,

JSR

@jeezypop

Thanks for your inquiry. Unfortunately, the correct workaround of this issue is not available at the moment. However, please try to add an empty Paragraph before inserting each section break. Hope this helps you.

builder.Writeln();
builder.InsertBreak(BreakType.SectionBreakNewPage)

Hi,


Thanks a lot, this “builder.Writeln()” seems to work fine!

Best regards,

JSr

Hi JSr,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

@jeezypop

It is to inform you that your issue has been closed with with “Won’t Fix” resolution.