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.

Fri Nov 21, 2014 7:06 pm

Hi there sir ,
i am not able to create a table of contents . is there any sample code you can provide me. I will remain grateful to you.
Regards
Masud

masud2002
 
Posts: 1
Joined: Fri Nov 21, 2014 7:02 pm

Mon Nov 24, 2014 2:32 am

Helllo,

Sorry for late reply as weekend. Thanks for your inquiry. Here are the code to create table of contents for your reference.
Code: Select all
Document doc = new Document();
Section section = doc.AddSection();
Paragraph para = section.AddParagraph();
para.AppendTOC(1, 3);
Paragraph para1 = section.AddParagraph();
para1.AppendText("Head1");
para1.ApplyStyle(BuiltinStyle.Heading1);
doc.UpdateTableOfContents();
doc.SaveToFile("CreateTableOfContent.docx", FileFormat.Docx);

If there are any questions or needs, please feel free to contact us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Nov 26, 2014 7:47 am

Hello,

Have you tried the method? Does it fulfill your needs? Could you please give us some feedback?

If you have any questions or needs, please feel free to contact us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc