4

I am producing a script which creates RTF documents and want to add a table of contents. I've opted for this:

{\field\flddirty\fldedit{\*\fldinst TOC}{\fldrslt \i Use this page to add the table of contents, right click to update field \i0}}

and the user will open the RTF in Microsoft Word and update the field. However, I'm unsure of how to format the sections in my RTF code to create headings so that when I update my TOC in Word it will show the sections. For now, when I "update field", I only get "No tables of contents entries found"

I've tried {\tc My heading here} with no luck.

Is there some code I can insert into my RTF to format my text as headers for TOC formatting in Word?

gimmian
  • 203
  • 2
  • 12

1 Answers1

4

I've figured out how to solve my problem. In Microsoft word, in order for {\tc Heading here } to appear in your table of contents, you must include Table entry fields. To incorporate this into your RTF code, instead of {\*\fldinst TOC} use {\*\fldinst TOC \o \h \f} \h enables HTML links and \f enables table entry fields. Now when you update the field, your {\tc Heading here } will appear in the table of contents.

This article helped me out: https://support.office.com/en-ca/article/Table-of-Contents-III-Use-fields-to-create-a-TOC-and-create-multiple-TOCs-f1509cfe-b48f-4ac5-8241-89a6619d7d6f

gimmian
  • 203
  • 2
  • 12