Anatomy of an RTF File
George Tisdale
April 30, 2005
Basic Components
Lead in Font table Color table Style sheet Information Data
Lead In
Identifies the file as an RTF file Sets the default language
Font Table
Lists the fonts that are used Equates the fonts with an f# reference
Example: f0 is Times New Roman in the previous slides
Color Table
List of colors as a mix of red, green and blue
Each item is separated by a semi-colon If an item is missing the default is used,
but the semi-colon must be present
Style Sheet
Mixes fonts, typeface sizes, boldness, indents, tabs and colors into a Style number
Styles are “\s##” two digit number usually starting at 11
Numbers are set at 1440=1 inch Tab stops are defined \tqc\tx2160 sets a
centering tab at 1.5 inches
RTF Document
RTF reader (Word) has interpreted the file and translated it into a formatted document.
LIBRTF.DLL
Prepares the skeleton of the file Converts simple annotations into RTF
code Replaces imbedded instructions with RTF
code Processes an RTF file from a passed
matrix of data
Syntax
FNRTF( MAT TYPES$, MAT STYLES$, MAT DATA$, RTFFILE; LMARGIN, RMARGIN)
(LMARGIN and RMARGIN are optional)
TYPES$
Matrix of single character codes H – header F – footer D – data T – Total
These are examples and not required usage
Styles
Matrix of same size as TYPES$ that defines the styles being used
Elements separated by pipes “|”
STYLES$(1)="li0|ri0|fs18|cfBlue|tc3.25|Header"
STYLES$(3)="li0.25|ri0|fs10||tl2.5|td3|tl3.2|td4.0|tl4.2|td4.6|tl4.8|td5.4|Data"
DATA$
Text to be printed by RTF reader Fields separated by pipes “|” Pipes represent TAB characters Additional tabs embedded with “\tab “ Grouped with “{“ and “}”
LET DATA$(1)="H|\b\tab Title Of Report"
RTFFILE
Existing open display file Open with
recl=32000 EOL=none
Margins
RTF reader will use its default margins Overrides can be set for WORD using
LMARGIN RMARGIN