We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

InsertTableOfContents with my own style

I have my own styles defined (kop1, kop2, kop3,…)
How do I telle InsertTableOfContents wich styles to take to generate de Table of contents TOC?

Thanks for your inquiry. I think that you don’t need to create new styles. I think that you should just edit existing styles (Heading1, Heading2, Heading3 etc). For example see the following code:

doc.Styles[StyleIdentifier.Heading1].Font.Name = "Arial";
doc.Styles[StyleIdentifier.Heading1].Font.Size = 36;
doc.Styles[StyleIdentifier.Heading1].Font.Bold = true;
doc.Styles[StyleIdentifier.Heading1].Font.Italic = true;

Hope this helps.
Best regards.

this gives the same effect