Free Support Forum -

Can you create cross-references to "captions"?

In Word, you are able to create a "caption" and then elsewhere in the document create a link to that caption. I would like to put a caption at the top of each of my records and have a Table of Contents display the page number to that caption. When you click on it, it will jump to that record. I would also like to have a few custom columns appended to this table. Is this possible?

Thank you


Thank you for considering Aspose.

If your “captions” style is one of built-in heading styles, the only thing you need is simply add a TOC that will be automatically associated with them. A TOC can be inserted using the DocumentBuilder.InsertTableOfContents method.

Another way are the TOC entries. These are regular MS Word TC fields containing some specific switches that can be inserted into the document via the DocumentBuilder.InsertField method. Please refer to the MS Word documentation to obtain information about these fields syntax. You can also put some TOC entries manually and see what switches they have. After inserting the entries, just insert a TOC using DocumentBuilder.InsertTableOfContents.

Since a table of contents in MS Word is just a regular field as well, it can be customized only by its possible switches. Please see the Field Codes: TOC topic in the MS Word documentation.

I apologize for misdirection: the TC fields are actually not regular MS Word fields and insertion of them is not possible (ones inserted by DocumentBuilder will not work) at the moment but will be available later. So use built-in heading styles to mark places to be included in the TOC.