Reputation: 533
I have many tables, I want to generate a table of contents(includling table titles) programtically.But I couldn't find or make any example RTF which have a TOC.
So is there a simple example showing a RTF with TOC?
Upvotes: 1
Views: 3816
Reputation: 83
Thought I would add a practical example as the documentation is not overly helpful to the way my mind works although it is all covered!
<xsl:text>{\tc\fs0\cf4 Report Details}</xsl:text>
<xsl:text>Report Details\cell</xsl:text>
to mark the item, and then display
<xsl:text>\page Table of Contents\line</xsl:text>
<xsl:text>{\field{\*\fldinst {\\TOC \\f \\h}}}</xsl:text>
open in Word
using Ctrl-A (select all) => F9 as the TOC has to be activated.
hope this helps
Upvotes: 1
Reputation: 5
After a lot of digging, I finally found the answer to this question. You need to use the bookmark feature to get a table of contents. See this question Add table of contents to RTF document
Upvotes: 0
Reputation: 4408
Check the rtf specs: http://www.biblioscape.com/rtf15_spec.htm#Heading62
The \tc control word introduces a table of contents entry, which can be used to build the actual table of contents. The \tcn control word marks a table of contents entry that will not have a page number associated with it; this is used in place of \tc for such entries. Table of contents entries are destinations, and they have the following syntax:
'{' \tc | \tcn (\tcf? & \tcl?) + '}'
As with index entries, text that is not formatted as hidden with the \v character-formatting control word is put into the document. The following control words can also be used in this destination.
Control words:
\tcfN Type of table being compiled. N is mapped by existing Microsoft software to a letter between A and Z (the default is 67, which maps to C, used for tables of contents).
\tclN Level number (the default is 1).
Upvotes: 2