Page numbers are not displaying in TOC fields


I am using latest Aspose.words 9.0 dlls and calling the below method to update TOC fields in my document. But unfortunately page numbers are not showing, insted of numbers displaying qutionsmarks (??) in document. I was using this statement to update TOC fields:

Document.UpdateFields() methods to achive this.

Is Updation of page numbers along with TOC fields update, not fixed in Aspose.words 9.0?


Hi Srinu,

Thanks for your request. Could you attach the document you are getting issues with?


Hi Srinu,
Use the following code.

Document doc = new Document(dataDir + "Test Document.doc");
doc.Save(dataDir + "Test Document Out.doc");

When you call the Document.UpdateFields method, Aspose.Words updates (entirely rebuilds) the TOC field, but does not insert page numbers into the TOC field yet. Aspose.Words calculates correct page numbers and inserts into the TOC when the document layout is built. To do this you need to call Document.UpdatePageLayout.
If this does not solve the issue then can you attach the documents for testing as Denis suggested.