Change the numbering of the table of Contents

Hi,


I want to change the table of contents of the “AsposeDoc.docx” document for the result “FinalDoc.docx” document.
Should I change the hyperlinks in the table of contents?

How do I get the following result:
TOC:
HEADING PAGE…1
Table of contents…1
Front Cover…1
CHAPTER 0 : INTRODUCTION…2
Introduction…2

Result:
HEADING PAGE…HDG
Table of contents…HDG
Front Cover…HDG
CHAPTER 0 : INTRODUCTION…CHAP0
Introduction…CHAP0

Source code of the “TOC” insertion:
DocumentBuilder builder = new DocumentBuilder(document);
builder.writeln();
Field tocField = builder.insertTableOfContents("\o “1-” + printOptions.get(DO_OPTION_TOCLEVEL) + “” \h \z \u");
tocField.update();

I look forward to your response.

Best Regards,
Patrice ANTOINE

Hi Antoine,


Thanks for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. Yes, you can add text like HD and CHAP before the numbers as you shared in your document but when you update fields this text will be removed from TOC. Please read following forum link for your kind reference.
https://forum.aspose.com/t/60963

It would be great if you please explain some more information about HD and CHAP text before page numbers.