02-21-2016 03:27 PM
When I run an ODS RTF statement without Bodytitle, I get what I expect (the "Update Field" option in Word, for creating a Table of Contents); when I include Bodytitle, the "Update Field" option isn't available - am I missing something? (I'm using SAS 9.4)
input name $ count;
/* without Bodytitle*/
ods rtf file='C:\temp\TEST1.rtf' contents toc_data ;
/* with Bodytitle*/
ods rtf file='C:\temp\TEST1.rtf' contents toc_data bodytitle;
proc report data=test;
column Name count;
define name/ group ;
define count /display;
ods rtf close;
02-22-2016 04:46 AM
Well, let me start by saying that RTF != Word. RTF is text markup, i.e. it is text with codes which certain programs can read and interpret. When you open and RTF file in Word, Word initiates its RTF parser software, parses the file and then decides how to render the text. Now Word is maliciously bad at these types of things, press delete foro instance on a subheading and suddenly the whole document's titels change font for instance. Unless your an expert at Word it is rare to find a solution to it.
Now to your question, bodytitle - this is an option to put titles in either the title section of Word, or, with the option bodytitle, to include that text as headings in the text of the document - i.e. you don't have titles then. How does Word do its table of contents (well who knows, I sure have never worked it out), but I imagine it links the document object - checks titles and headings, and makes its best guess. Personally, I would never rely on Word to create contents tables.
One thing I can suggest you do is to open the two files, one with bodytitle and one without in a proper text editor (Notepad++ for instance), and have a look at what tagset output is being created. Find the text of the titles and you will see they either appear in different places, or have different tags surrounding the title (or both), which means the RTF parser in Word will treat these as different.
Need further help from the community? Please ask a new question.