##### 37.1.1.6 Obtaining RTF code for macro definitions

RTF coding is arcane, especially for tables. Unless you are an RTF expert, your best bet might be to copy existing RTF code. Here are some ways to obtain RTF code for your macros:

Get code examples from Word

Get code examples from DITA2Go

Generate RTF code with DITA2Go.

Get code examples from Word

You can pretty-print RTF output from Word to mine for code (if you open a Word RTF file directly in a text editor, you see only unbroken lines of unreadable code):

1. In Word, create an example of the output you want.
2. Save as RTF from Word.
3. At a Windows command prompt, run pretty-printer program pprtf.exe on the saved RTF. The pprtf.exe program is included in your DITA2Go distribution directory.

The RTF pretty-printer, pprtf.exe, takes either one or two arguments:

- the name of the RTF file, with extension
- optionally, a different name for the output file, with extension

and creates a new file:

    pprtf ExampleFile.rtf NewFile.txt

If you omit the second argument, the output is a file of the same name as the RTF file, but with extension .txt.

Get code examples from DITA2Go

Another way to obtain RTF code is to create an example in DITA, run DITA2Go, and then copy/paste the resulting RTF code into your d2rtf.ini configuration file or into a macro library file. DITA2Go produces RTF output that is even more readable than the output from pprtf.exe.

Generate RTF code with DITA2Go

For paragraphs, you can use CodeStore to generate RTF code; see §37.3.5.2 Inserting code with the CodeStore property.

Previous Topic: 37.1.1.5 Including comments in macro definitions

Next Topic: 37.1.2 Invoking a macro

Parent Topic: 37.1.1 Defining macros

Sibling Topics:

37.1.1.1 Understanding what a macro definition can include

37.1.1.2 Understanding where you can define named macros

37.1.1.3 Escaping special characters in macro definitions

37.1.1.4 Managing line breaks in macro definitions

37.1.1.5 Including comments in macro definitions

Table of Contents • Index