TOC whith DOCX?

Hi,
I’ve just discovered Aspose components and I’m very impressed.
Notwithstanding , I’m not able to create a TOC and save into docx format. Am I missing sommething?

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertTableOfContents("\\f \\h");
builder.InsertBreak(BreakType.PageBreak);
// Insert TC field that represents TOC element
builder.InsertField("TC \"Tracker Panels(Item 1)\" \\n \\l 1", "");
builder.Writeln("Tracker Panels");
builder.InsertField("TC \"Tag Data\" \\l 2", "");
builder.Writeln("Tag Data");
builder.InsertField("TC \"Product Data\" \\l 2", "");
builder.Writeln("Product Data");
doc.Save("out.doc"); //Works OK
doc.Save("out.docx"); //Cannot find de TOC

Hi

Thanks for your request. You can insert TOC field using Aspose.Words, but in the result document, actual table of contents will not be displayed. You should update TOC in MS Word to display it.
The next version of Aspose.Words will support updating TOC fields. So you will be able to insert and update TOC field using Aspose.Words. The next version will be released within 4-5 weeks. You will be notified as soon as this feature is available.
Best regards,

Will updated TOC fields be available for all output formats?

I’ve actually found the problem.
In my Dev post I’ve got Office Word 2003 with the compatibility pack for reading docx documents. Unfortunatelly, aspose TOC doesn’t work with this patch (at least with this code). I’ve tested the output file with an Office word 2007 and it works great and of course, the .doc version also works.

Hello Magnus,

Yes, update TOC will be supported for all formats.
Susana, it is perfect, that you already resolved the problem. If you need more assistance, I will be glad to help you.
Best regards,

Was this implemented in 8.2? Can’t find any information about it.

Hello

Thanks for your inquiry. Unfortunately, 8.2.0 version of Aspose.Words does not support updating TOC. Your request has been linked to the appropriate issues. You will be notified as soon as this feature is available.
We are going to support TOC fields evaluation in few weeks.
Also please see the following link to learn what fields are supported:
https://docs.aspose.com/words/net/update-fields/
Best regards,

The issues you have found earlier (filed as 10380) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(11)