Thanks for a great product and most of all the automatic TOC feature in version 9!
When I was about to use the new version in our solution I found that the TOC wasn’t generated at all in the ‘template’ document that we fill with text. After some researching I found out that it was a problem with the TOC field code that Word 2007 had generated when it was added to the document.
The problem appears if I use custom style reference for heading levels. Using the TOC dialog clicking options and removing the Heading1-3 levels and setting my custom styles as new levels for the TOC.
This generates a field code with something like this:
TOC \h \z \t "CustomHeading 1;1;CustomHeading2;2"
According to Microsoft’s own online help on TOC Field Code (found here
) it states the following syntax:
\t "Style,Level, Style,Level,…"
Note the the difference in the separation character! Word generates semicolon ( but according to the help it should be comma (,). I made the conclusion that Aspose.Words couldn’t handle the case where semicolon was used, which made my custom document to not render the TOC. When I manually changed it to comma in the ‘template’ document it worked like a charm.
This is actually a bug in Word 2007, but I suggest that you update your software so it can cope with this.
Attached is a word document containing some text with custom heading styles and a TOC generated by Word (containing the wrong separator character).
Br,
Andreas Backman