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

Free Support Forum - aspose.com

Aspose word TOC with Custom Style

Hi There,

I have been trying Aspose word TOC with Custom Style, However, it shows only first item in TOC. It works fine with pre define styles such as heading1 etc.

Here is my code

builder.InsertTableOfContents("\h \z \u \t “Style1,1"”);

it works with heading1

builder.InsertTableOfContents("\o “1-1” \h \z \u");

Please let me know if i need to add any additional switch for Custom Style.



Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 17.8 with following code example and have not found the shared issue. Please use Aspose.Words for .NET 17.8. We have attached the documents with this post for your kind reference. documents.zip (18.2 KB)

If you still face problem, please share your input and output documents here for testing. We will investigate the issue on our side and provide you more information.

Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertTableOfContents(@"\h \z \t ""Style1,1""");

doc.Save(MyDir + "17.8.docx");