Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Feb 06, 2023 3:24 am

Hi Team ,

I have written the below mentioned code to append the Table Of Contents in Docx file

Paragraph para = section.addParagraph();


para.appendTOC(1, 3);


}

Unfortunately Page number is not displaying and each content has underline .Please help me to get page number and remove an underline .

Please find the attached screenshot for your reference.

Thanks in advance

pr20080798
 
Posts: 159
Joined: Wed Jan 20, 2021 1:15 pm

Mon Feb 06, 2023 8:29 am

Hi,

Thanks for your inquiry.
Please call doc.UpdateTableOfContents() to update the TOC after operating the document, I created a simple demo but I did not reproduce your issue, the page number is displayed and there is no underline. I attached my demo for your reference, please download it and did a test (please import Spire.Doc dll manually), if your issue still exists, please provide us with your full code and input document to help us work out a solution. You can send them to us via email ([email protected]) or attach them here. Thanks for your assistance.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Tue Feb 14, 2023 5:47 am

Hi Team ,

Thank you for your response .

In my document file ,heading2 has underline due to this reason TOC come up with Underline . Please let me know how to avoid underline in TOC Section.

Unfortunately Page number is not coming. Please go through the code I have written to add TOC.

code :
void addTableOfContent(final Section section, Boolean isDoc, Document doc) {

Paragraph para = section.addParagraph();
if(isDoc){

para.appendTOC(2, 2);

} else{

para.appendTOC(1, 3);


}

pr20080798
 
Posts: 159
Joined: Wed Jan 20, 2021 1:15 pm

Tue Feb 14, 2023 10:27 am

Hi,

Thanks for your reply.
Could you please provide us with you code which used to set the paragraph style? So that we can do an accurate investigation and provide you with an effective solution, you can send it to us via email ([email protected]) or attach it here. Thanks for your assistance.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.Doc

cron