6.15 Including RTF code for Word output
If you want to do complicated things with RTF, you need to know the coding rules. Microsoft provides very little in the way of documentation, and the specification is incomplete. The best approach is to do what you want in a tiny file in Word itself, save as RTF, and use the Omni Systems pretty-print utility to make the result readable:
Study what Word did to produce that output. Make sure the braces {} are balanced in the fragment you extract from the Word output, and double the backslashes.
For example, suppose you want to use a Mif2Go macro to pull an image into the title page for your Word document, so in RTF you get an INCLUDEPICTURE field:
{ INCLUDEPICTURE "MyLogo.bmp" \* MERGEFORMAT \d \x \y }
Because backslash is meaningful both in RTF code and in Mif2Go macros, you must double any backslashes within fields and then double them again for the macro; so you end up with something like this to get what you want into RTF:
{\\field {\\*\\fldinst INCLUDEPICTURE "MyLogo.bmp" \\\\d \\\\x \\\\y
\\\\* MERGEFORMAT }{\\fldrslt }}
If you look at the resulting RTF with a text editor after you run the Mif2Go conversion, you should see:
{\field {\*\fldinst INCLUDEPICTURE "MyLogo.bmp" \\d \\x \\y
Line breaks are acceptable in RTF code.
> 6 Converting to print RTF > 6.15 Including RTF code for Word output