The GC0165 disk included with this Application Note contains the sample RTF reader program RTFREADR.EXE, which will help you create an RTF reader for your own application when used in conjunction with the Microsoft Rich Text Format Specification and the information below.
Note The sample RTF reader is not a for-sale product, and Microsoft does not provide technical or any other type of support for the sample RTF reader code or the RTF specification.
There are three basic things that an RTF reader must do:
1. Separate text from RTF controls.
2. Parse an RTF control.
3. Dispatch an RTF control.
Separating text from RTF controls is relatively simple, because all RTF controls begin with a backslash. Therefore, any incoming character that is not a backslash is text and will be handled as text. (Of course, what one does with that text may be relatively complicated.)
Parsing an RTF control is also relatively simple. An RTF control is either (a) a sequence of alphabetic characters followed by an optional numeric parameter, or (b) a single non-alphanumeric character.
Dispatching an RTF control, on the other hand, is relatively complicated. A recursive-descent parser tends to be overly strict because RTF is intentionally vague about the order of various properties relative to one another. However, whatever method you use to dispatch an RTF control, your reader should do the following:
* Ignore control words you don't understand.
Many readers crash when they come across an unknown RTF control. Because Microsoft is continually adding new RTF controls, this limits an RTF reader to working with the RTF from one particular product (usually some version of Word for Windows).
* Always understand \*.
One of the most important things an RTF reader can do is to understand the \* control. This control introduces a destination that is not part of the document. It tells the RTF reader that if the reader does not understand the next control word, then it should skip the entire enclosing group. If your reader follows this rule and the one above, your reader will be able to cope with any future change to RTF short of a complete rewrite.
* Remember that binary data can occur when you're skipping RTF.
A simple way to skip a group in RTF is to keep a running count of the opening braces that the reader has encountered in the RTF stream. When the reader sees an opening brace, it increments the count; when the reader sees a closing brace, it decrements the count. When the count becomes negative, the end of the group has been found. Unfortunately, this doesn't work when the RTF file contains a \bin control; the reader must explicitly check each control word found to see if it's a \bin control, and, if a \bin control is found, skip that many bytes before resuming its scanning for braces.
The Microsoft Word Processing Conversions group uses a table-driven approach to reading RTF. This approach allows the most flexibility in reading RTF, with the corresponding problem that it's difficult to detect incorrect RTF. An RTF reader that is based on this approach is presented below. This reader works exactly as described in the RTF specification and uses the principles of operation described in the RTF specification. This reader is designed to be simple to understand but is not intended to be very efficient. This RTF reader also implements the three design principles listed in the previous section.
The RTF reader consists of four files:
* Rtfdecl.h, which contains the prototypes for all the functions in the RTF reader
* Rtftype.h, which contains the types used in the RTF reader
* Rtfreadr.c, which contains the main program, the main loop of the RTF reader, and the RTF control parser
* Rtfactn.c, which contains the dispatch routines for the RTF reader
Rtfdecl.h is straightforward and requires little explanation.
rtfreadr.c is also reasonably straightforward; the function ecRtfParse separates text from RTF controls and handles text, and the function ecParseRtfKeyword parses an RTF control and also collects any parameter that follows the RTF control.
Rtftype.h begins by declaring a sample set of character, paragraph, section, and document properties. These structures are present to demonstrate how the dispatch routines can modify any particular property and are not actually used to format text.
For example, the following enumeration describes which destination text should be routed to:
typedef enum { rdsNorm, rdsSkip } RDS;
Because this is just a sample RTF reader, there are only two destinations; a more complicated reader would add an entry to this enumeration for each destination supported [for example, headers, footnotes, endnotes, comments (annotations), bookmarks, and pictures].
The following enumeration describes the internal state of the RTF parser:
typedef enum { risNorm, risBin, risHex } RIS;
This is entirely separate from the state of the dispatch routines and the destination state; other RTF readers may not necessarily have anything similar to this.
The following structure encapsulates the state that must be saved at a group start and restored at a group end:
typedef struct save { struct save *pNext; CHP chp; PAP pap; SEP sep; DOP dop; RDS rds; RIS ris; } SAVE;
The following enumeration describes a set of classes for RTF controls:
typedef enum {kwdChar, kwdDest, kwdProp, kwdSpec} KWD;
Use kwdChar for controls that represent special characters (such as \-, \{, or \}).
Use kwdDest for controls that introduce RTF destinations.
Use kwdProp for controls that modify some sort of property.
Use kwdSpec for controls that need to run some specialized code.
The following enumeration defines the number of PROP structures (described below) that will be used. There will typically be an iprop for every field in the character, paragraph, section, and document properties.
typedef enum {ipropBold, ipropItalic, ipropUnderline, ipropLeftInd, ipropRightInd, ipropFirstInd, ipropCols, ipropPgnX, ipropPgnY, ipropXaPage, ipropYaPage, ipropXaLeft, ipropXaRight, ipropYaTop, ipropYaBottom, ipropPgnStart, ipropSbk, ipropPgnFormat, ipropFacingp, ipropLandscape, ipropJust, ipropPard, ipropPlain, ipropMax} IPROP;
The following structure is a very compact way to describe how to locate the address of a particular value in one of the property structures:
typedef enum {actnSpec, actnByte, actnWord} ACTN; typedef enum {propChp, propPap, propSep, propDop} PROPTYPE; typedef struct propmod { ACTN actn; PROPTYPE prop; int offset; } PROP;
The actn field describes the width of the value being described: if the value is a byte, then actn is actnByte; if the value is a word, then actn is actnWord; if the value is neither a byte nor a word, then you can use actnSpec to indicate that some C code needs to be run to set the value. The prop field indicates which property structure is being described; propChp indicates that the value is located within the CHP structure; propPap indicates that the value is located within the PAP structure, and so on. Finally, the offset field contains the offset of the value from the start of the structure. The offsetof() macro is usually used to initialize this field.
The following structure describes how to parse a particular RTF control:
typedef enum {ipfnBin, ipfnHex, ipfnSkipDest } IPFN; typedef enum {idestPict, idestSkip } IDEST; typedef struct symbol { char *szKeyword; int dflt; bool fPassDflt; KWD kwd; int idx; } SYM;
szKeyword points to the RTF control being described; kwd describes the class of the particular RTF control (described above); dflt is the default value for this control, and fPassDflt should be nonzero if the value in dflt should be passed to the dispatch routine. (fPassDflt is only nonzero for control words that normally set a particular value. For example, the various section break controls typically have nonzero fPassDflt controls, but controls that take parameters should not.)
Idx is a generalized index; its use depends on the kwd being used for this control.
* If kwd is kwdChar, then idx is the character that should be output.
* If kwd is kwdDest, then idx is the idest for the new destination.
* If kwd is kwdProp, then idx is the iprop for the appropriate property.
* If kwd is kwdSpec, then idx is an ipfn for the appropriate function.
With this structure, it is very simple to dispatch an RTF control word. Once the reader isolates the RTF control word and its (possibly associated) value, the reader then searches an array of SYM structures to find the RTF control word. If the control word is not found, the reader ignores it, unless the previous control was \*, in which case the reader must scan past an entire group.
If the control word is found, the reader then uses the kwd value from the SYM structure to determine what to do. This is, in fact, exactly what the function ecTranslateKeyword in the file RTFACTN.C does.
Rtfactn.c contains the tables describing the properties and control words, and the routines to evaluate properties (ecApplyPropChange) and to dispatch control words (ecTranslateKeyword).
The tables are the keys to understanding the RTF dispatch routines. The following are some sample entries from both tables, along with a brief explanation of each entry.
The Property Table. This table must have an entry for every iprop.
actnByte, propChp, offsetof(CHP, fBold), // ipropBold
This property says that the ipropBold property is a byte parameter bound to chp.fBold.
actnWord, propPap, offsetof(PAP, xaRight), // ipropRightInd
This property says that ipropRightInd is a word parameter bound to pap.xaRight.
actnWord, propSep, offsetof(SEP, cCols), // ipropCols
This property says that ipropCols is a word parameter bound to sep.cCols.
actnSpec, propChp, 0, // ipropPlain
This property says that ipropPlain is a special parameter. Instead of directly evaluating it, ecApplyPropChange will run some custom C code to apply a property change.
The Control Word Table.
"b", 1, fFalse, kwdProp, ipropBold,
This structure says that the control \b sets the ipropBold property. Because fPassDflt is False, the reader only uses the default value if the control does not have a parameter. If no parameter is provided, the reader uses a value of 1.
"sbknone", sbkNon, fTrue, kwdProp, ipropSbk,
This entry says that the control \sbknone sets the ipropSbk property. Because fPassDflt is True, the reader always uses the default value of sbkNon, even if the control has a parameter.
"par", 0, fFalse, kwdChar, 0x0a,
This entry says that the control \par is equivalent to a 0x0a (linefeed) character.
"tab", 0, fFalse, kwdChar, 0x09,
This entry says that the control \tab is equivalent to a 0x09 (tab) character.
"bin", 0, fFalse, kwdSpec, ipfnBin,
This entry says that the control \bin should run some C code. The particular piece of C code can be located by the ipfnBin parameter.
"fonttbl", 0, fFalse, kwdDest, idestSkip,
This entry says that the control \fonttbl should change to the destination idestSkip.
The table-driven approach to dispatching RTF controls used by the sample converter does not implement any syntax checking. For most controls, this is not a problem; a control simply modifies the appropriate property. However, some controls, such as those for tabs and borders, are dependent on other control words either before or after the current control word.
There are some standard techniques for handling these features.
The best way to implement these types of control sequences is to have a global structure that represents the current state of the tab descriptor (or other entity). As the modifiers come in, they modify the various fields of the global structure. When the fixed control at the end of the sequence is dispatched, it adds the entire descriptor and reinitializes the global variable.
The best way to implement these types of control sequences is to have a global pointer that is initialized when the fixed control is dispatched. The controls that modify the fixed control then modify fields pointed to by the control.
Style sheets can be handled as destinations; however, styles have default values, just as every other control does. RTF readers should be sure to handle a missing style control as the default style value (that is, 0).
Some RTF readers use various bits of RTF syntax to mark property changes. In particular, they assume that property changes will occur only after a group start, which is not correct. Because there is a variety of ways to represent identical property changes in RTF, RTF readers should look at the changes in the properties and not at any particular way of representing a property change. In particular, properties can be changed explicitly with a control word or implicitly at the end of a group. For example, these three sequences of RTF have exactly the same semantics, and should be translated identically:
* {\b bold \i Bold Italic \i0 Bold again} * {\b bold {\i Bold Italic }Bold again} * {\b bold \i Bold Italic \plain\b Bold again}
All versions of Microsoft Word for Windows and version 6.0 and later of Microsoft Word for the Macintosh have fields. If you're writing an RTF reader and expect to do anything with fields, keep the following notes in mind:
* Field instructions may have arbitrary amounts of character formatting and arbitrarily nested groups. While the groups will be properly nested within the field instructions, you may be inside an arbitrary number of groups by the time you know which field you are working with. If you then expect to be able to skip to the end of the field instructions, you'll have to know how many groups have started so that you can skip to the end properly.
* Some fields, the INCLUDE field in particular, can have section breaks in the field results. If this occurs, then the text after the end of the field does not have the same section properties as the text at the start of the field; the section properties must not be restored when the field results contain section breaks.
Tables are probably the trickiest part of RTF to read and write correctly. Because of the way Microsoft word processors implement tables, and the table-driven approach of many Microsoft RTF readers, it is very easy to write tables in RTF that will crash Microsoft word processors when you try to read the RTF. Here are some guidelines to reduce problems with tables in RTF:
* Place the entire table definition before any paragraph properties, including \pard.
* Make sure the number of cells in the RTF matches the number of cell definitions.
* Some controls must be the same in all paragraphs in a row. In particular, all paragraphs in a row must have the same positioning controls, and all paragraphs in a row must have \intbl specified.
* Do not use the \sbys control inside a table. \sbys is a holdover from Word for MS-DOS and early versions of Word for the Macintosh. Word for Windows and current versions of Word for the Macintosh translate \sbys as a table. Because Word for Windows and Word for the Macintosh do not support nested tables, these products will probably crash if you specify \sbys in a table.
* Cell definitions starting before the left margin of the paper begins (that is, the parameter plus the left margin is negative) are always in error.
* Even though nested tables are not explicitly defined in RTF, and Word for Windows and Word for the Macintosh do not support nested tables, you must still save table properties when changing destinations because tables can be nested inside other destinations--that is, you can have a table that contains a footnote or an annotation, and the footnote or annotation can contain another table.
// RTF parser declarations int ecRtfParse(FILE *fp); int ecPushRtfState(void); int ecPopRtfState(void); int ecParseRtfKeyword(FILE *fp); int ecParseChar(int c); int ecTranslateKeyword(char *szKeyword, int param, bool fParam); int ecPrintChar(int ch); int ecEndGroupAction(RDS rds); int ecApplyPropChange(IPROP iprop, int val); int ecChangeDest(IDEST idest); int ecParseSpecialKeyword(IPFN ipfn); int ecParseSpecialProperty(IPROP iprop, int val); int ecParseHexByte(void); // RTF variable declarations extern int cGroup; extern RDS rds; extern RIS ris; extern CHP chp; extern PAP pap; extern SEP sep; extern DOP dop; extern SAVE *psave; extern long cbBin; extern long lParam; extern bool fSkipDestIfUnk; extern FILE *fpIn; // RTF parser error codes #define ecOK 0 // Everything's fine! #define ecStackUnderflow 1 // Unmatched '}' #define ecStackOverflow 2 // Too many '{' -- memory exhausted #define ecUnmatchedBrace 3 // RTF ended during an open group. #define ecInvalidHex 4 // invalid hex character found in data #define ecBadTable 5 // RTF table (sym or prop) invalid #define ecAssertion 6 // Assertion failure #define ecEndOfFile 7 // End of file reached while reading RTF
typedef char bool; #define fTrue 1 #define fFalse 0 typedef struct char_prop { char fBold; char fUnderline; char fItalic; } CHP; // CHaracter Properties typedef enum {justL, justR, justC, justF } JUST; typedef struct para_prop { int xaLeft; // left indent in twips int xaRight; // right indent in twips int xaFirst; // first line indent in twips JUST just; // justification } PAP; // PAragraph Properties typedef enum {sbkNon, sbkCol, sbkEvn, sbkOdd, sbkPg} SBK; typedef enum {pgDec, pgURom, pgLRom, pgULtr, pgLLtr} PGN; typedef struct sect_prop { int cCols; // number of columns SBK sbk; // section break type int xaPgn; // x position of page number in twips int yaPgn; // y position of page number in twips PGN pgnFormat; // how the page number is formatted } SEP; // SEction Properties typedef struct doc_prop { int xaPage; // page width in twips int yaPage; // page height in twips int xaLeft; // left margin in twips int yaTop; // top margin in twips int xaRight; // right margin in twips int yaBottom; // bottom margin in twips int pgnStart; // starting page number in twips char fFacingp; // facing pages enabled? char fLandscape; // landscape or portrait?? } DOP; // DOcument Properties typedef enum { rdsNorm, rdsSkip } RDS; // Rtf Destination State typedef enum { risNorm, risBin, risHex } RIS; // Rtf Internal State typedef struct save // property save structure { struct save *pNext; // next save CHP chp; PAP pap; SEP sep; DOP dop; RDS rds; RIS ris; } SAVE; // What types of properties are there? typedef enum {ipropBold, ipropItalic, ipropUnderline, ipropLeftInd, ipropRightInd, ipropFirstInd, ipropCols, ipropPgnX, ipropPgnY, ipropXaPage, ipropYaPage, ipropXaLeft, ipropXaRight, ipropYaTop, ipropYaBottom, ipropPgnStart, ipropSbk, ipropPgnFormat, ipropFacingp, ipropLandscape, ipropJust, ipropPard, ipropPlain, ipropSectd, ipropMax } IPROP; typedef enum {actnSpec, actnByte, actnWord} ACTN; typedef enum {propChp, propPap, propSep, propDop} PROPTYPE; typedef struct propmod { ACTN actn; // size of value PROPTYPE prop; // structure containing value int offset; // offset of value from base of structure } PROP; typedef enum {ipfnBin, ipfnHex, ipfnSkipDest } IPFN; typedef enum {idestPict, idestSkip } IDEST; typedef enum {kwdChar, kwdDest, kwdProp, kwdSpec} KWD; typedef struct symbol { char *szKeyword; // RTF keyword int dflt; // default value to use bool fPassDflt; // true to use default value from this table KWD kwd; // base action to take int idx; // index into property table if kwd == kwdProp // index into destination table if kwd == kwdDest // character to print if kwd == kwdChar } SYM;
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include "rtftype.h" #include "rtfdecl.h" int cGroup; bool fSkipDestIfUnk; long cbBin; long lParam; RDS rds; RIS ris; CHP chp; PAP pap; SEP sep; DOP dop; SAVE *psave; FILE *fpIn; // // %%Function: main // // Main loop. Initialize and parse RTF. // main(int argc, char *argv[]) { FILE *fp; int ec; fp = fpIn = fopen("test.rtf", "r"); if (!fp) { printf ("Can't open test file!\n"); return 1; } if ((ec = ecRtfParse(fp)) != ecOK) printf("error %d parsing rtf\n", ec); else printf("Parsed RTF file OK\n"); fclose(fp); return 0; } // // %%Function: ecRtfParse // // Step 1: // Isolate RTF keywords and send them to ecParseRtfKeyword; // Push and pop state at the start and end of RTF groups; // Send text to ecParseChar for further processing. // int ecRtfParse(FILE *fp) { int ch; int ec; int cNibble = 2; int b = 0; while ((ch = getc(fp)) != EOF) { if (cGroup < 0) return ecStackUnderflow; if (ris == risBin) // if we're parsing binary data, handle it directly { if ((ec = ecParseChar(ch)) != ecOK) return ec; } else { switch (ch) { case '{': if ((ec = ecPushRtfState()) != ecOK) return ec; break; case '}': if ((ec = ecPopRtfState()) != ecOK) return ec; break; case '\\': if ((ec = ecParseRtfKeyword(fp)) != ecOK) return ec; break; case 0x0d: case 0x0a: // cr and lf are noise characters... break; default: if (ris == risNorm) { if ((ec = ecParseChar(ch)) != ecOK) return ec; } else { // parsing hex data if (ris != risHex) return ecAssertion; b = b << 4; if (isdigit(ch)) b += (char) ch - '0'; else { if (islower(ch)) { if (ch < 'a' || ch > 'f') return ecInvalidHex; b += (char) ch - 'a'; } else { if (ch < 'A' || ch > 'F') return ecInvalidHex; b += (char) ch - 'A'; } } cNibble--; if (!cNibble) { if ((ec = ecParseChar(b)) != ecOK) return ec; cNibble = 2; b = 0; ris = risNorm; } } // end else (ris != risNorm) break; } // switch } // else (ris != risBin) } // while if (cGroup < 0) return ecStackUnderflow; if (cGroup > 0) return ecUnmatchedBrace; return ecOK; } // // %%Function: ecPushRtfState // // Save relevant info on a linked list of SAVE structures. // int ecPushRtfState(void) { SAVE *psaveNew = malloc(sizeof(SAVE)); if (!psaveNew) return ecStackOverflow; psaveNew -> pNext = psave; psaveNew -> chp = chp; psaveNew -> pap = pap; psaveNew -> sep = sep; psaveNew -> dop = dop; psaveNew -> rds = rds; psaveNew -> ris = ris; ris = risNorm; psave = psaveNew; cGroup++; return ecOK; } // // %%Function: ecPopRtfState // // If we're ending a destination (that is, the destination is changing), // call ecEndGroupAction. // Always restore relevant info from the top of the SAVE list. // int ecPopRtfState(void) { SAVE *psaveOld; int ec; if (!psave) return ecStackUnderflow; if (rds != psave->rds) { if ((ec = ecEndGroupAction(rds)) != ecOK) return ec; } chp = psave->chp; pap = psave->pap; sep = psave->sep; dop = psave->dop; rds = psave->rds; ris = psave->ris; psaveOld = psave; psave = psave->pNext; cGroup--; free(psaveOld); return ecOK; } // // %%Function: ecParseRtfKeyword // // Step 2: // get a control word (and its associated value) and // call ecTranslateKeyword to dispatch the control. // int ecParseRtfKeyword(FILE *fp) { int ch; char fParam = fFalse; char fNeg = fFalse; int param = 0; char *pch; char szKeyword[30]; char szParameter[20]; szKeyword[0] = '\0'; szParameter[0] = '\0'; if ((ch = getc(fp)) == EOF) return ecEndOfFile; if (!isalpha(ch)) // a control symbol; no delimiter. { szKeyword[0] = (char) ch; szKeyword[1] = '\0'; return ecTranslateKeyword(szKeyword, 0, fParam); } for (pch = szKeyword; isalpha(ch); ch = getc(fp)) *pch++ = (char) ch; *pch = '\0'; if (ch == '-') { fNeg = fTrue; if ((ch = getc(fp)) == EOF) return ecEndOfFile; } if (isdigit(ch)) { fParam = fTrue; // a digit after the control means we have a parameter for (pch = szParameter; isdigit(ch); ch = getc(fp)) *pch++ = (char) ch; *pch = '\0'; param = atoi(szParameter); if (fNeg) param = -param; lParam = atol(szParameter); if (fNeg) param = -param; } if (ch != ' ') ungetc(ch, fp); return ecTranslateKeyword(szKeyword, param, fParam); } // // %%Function: ecParseChar // // Route the character to the appropriate destination stream. // int ecParseChar(int ch) { if (ris == risBin && --cbBin <= 0) ris = risNorm; switch (rds) { case rdsSkip: // Toss this character. return ecOK; case rdsNorm: // Output a character. Properties are valid at this point. return ecPrintChar(ch); default: // handle other destinations.... return ecOK; } } // // %%Function: ecPrintChar // // Send a character to the output file. // int ecPrintChar(int ch) { // unfortunately, we don't do a whole lot here as far as layout goes... putchar(ch); return ecOK; }RTFACTN.C #include <stdio.h> #include <string.h> #include <stddef.h> #include <ctype.h> #include "rtftype.h" #include "rtfdecl.h" // RTF parser tables // Property descriptions PROP rgprop [ipropMax] = { actnByte, propChp, offsetof(CHP, fBold), // ipropBold actnByte, propChp, offsetof(CHP, fItalic), // ipropItalic actnByte, propChp, offsetof(CHP, fUnderline), // ipropUnderline actnWord, propPap, offsetof(PAP, xaLeft), // ipropLeftInd actnWord, propPap, offsetof(PAP, xaRight), // ipropRightInd actnWord, propPap, offsetof(PAP, xaFirst), // ipropFirstInd actnWord, propSep, offsetof(SEP, cCols), // ipropCols actnWord, propSep, offsetof(SEP, xaPgn), // ipropPgnX actnWord, propSep, offsetof(SEP, yaPgn), // ipropPgnY actnWord, propDop, offsetof(DOP, xaPage), // ipropXaPage actnWord, propDop, offsetof(DOP, yaPage), // ipropYaPage actnWord, propDop, offsetof(DOP, xaLeft), // ipropXaLeft actnWord, propDop, offsetof(DOP, xaRight), // ipropXaRight actnWord, propDop, offsetof(DOP, yaTop), // ipropYaTop actnWord, propDop, offsetof(DOP, yaBottom), // ipropYaBottom actnWord, propDop, offsetof(DOP, pgnStart), // ipropPgnStart actnByte, propSep, offsetof(SEP, sbk), // ipropSbk actnByte, propSep, offsetof(SEP, pgnFormat), // ipropPgnFormat actnByte, propDop, offsetof(DOP, fFacingp), // ipropFacingp actnByte, propDop, offsetof(DOP, fLandscape), // ipropLandscape actnByte, propPap, offsetof(PAP, just), // ipropJust actnSpec, propPap, 0, // ipropPard actnSpec, propChp, 0, // ipropPlain actnSpec, propSep, 0, // ipropSectd }; // Keyword descriptions SYM rgsymRtf[] = { // keyword dflt fPassDflt kwd idx "b", 1, fFalse, kwdProp, ipropBold, "u", 1, fFalse, kwdProp, ipropUnderline, "i", 1, fFalse, kwdProp, ipropItalic, "li", 0, fFalse, kwdProp, ipropLeftInd, "ri", 0, fFalse, kwdProp, ipropRightInd, "fi", 0, fFalse, kwdProp, ipropFirstInd, "cols", 1, fFalse, kwdProp, ipropCols, "sbknone", sbkNon, fTrue, kwdProp, ipropSbk, "sbkcol", sbkCol, fTrue, kwdProp, ipropSbk, "sbkeven", sbkEvn, fTrue, kwdProp, ipropSbk, "sbkodd", sbkOdd, fTrue, kwdProp, ipropSbk, "sbkpage", sbkPg, fTrue, kwdProp, ipropSbk, "pgnx", 0, fFalse, kwdProp, ipropPgnX, "pgny", 0, fFalse, kwdProp, ipropPgnY, "pgndec", pgDec, fTrue, kwdProp, ipropPgnFormat, "pgnucrm", pgURom, fTrue, kwdProp, ipropPgnFormat, "pgnlcrm", pgLRom, fTrue, kwdProp, ipropPgnFormat, "pgnucltr", pgULtr, fTrue, kwdProp, ipropPgnFormat, "pgnlcltr", pgLLtr, fTrue, kwdProp, ipropPgnFormat, "qc", justC, fTrue, kwdProp, ipropJust, "ql", justL, fTrue, kwdProp, ipropJust, "qr", justR, fTrue, kwdProp, ipropJust, "qj", justF, fTrue, kwdProp, ipropJust, "paperw", 12240, fFalse, kwdProp, ipropXaPage, "paperh", 15480, fFalse, kwdProp, ipropYaPage, "margl", 1800, fFalse, kwdProp, ipropXaLeft, "margr", 1800, fFalse, kwdProp, ipropXaRight, "margt", 1440, fFalse, kwdProp, ipropYaTop, "margb", 1440, fFalse, kwdProp, ipropYaBottom, "pgnstart", 1, fTrue, kwdProp, ipropPgnStart, "facingp", 1, fTrue, kwdProp, ipropFacingp, "landscape",1, fTrue, kwdProp, ipropLandscape, "par", 0, fFalse, kwdChar, 0x0a, "\0x0a", 0, fFalse, kwdChar, 0x0a, "\0x0d", 0, fFalse, kwdChar, 0x0a, "tab", 0, fFalse, kwdChar, 0x09, "ldblquote",0, fFalse, kwdChar, '"', "rdblquote",0, fFalse, kwdChar, '"', "bin", 0, fFalse, kwdSpec, ipfnBin, "*", 0, fFalse, kwdSpec, ipfnSkipDest, "'", 0, fFalse, kwdSpec, ipfnHex, "author", 0, fFalse, kwdDest, idestSkip, "buptim", 0, fFalse, kwdDest, idestSkip, "colortbl", 0, fFalse, kwdDest, idestSkip, "comment", 0, fFalse, kwdDest, idestSkip, "creatim", 0, fFalse, kwdDest, idestSkip, "doccomm", 0, fFalse, kwdDest, idestSkip, "fonttbl", 0, fFalse, kwdDest, idestSkip, "footer", 0, fFalse, kwdDest, idestSkip, "footerf", 0, fFalse, kwdDest, idestSkip, "footerl", 0, fFalse, kwdDest, idestSkip, "footerr", 0, fFalse, kwdDest, idestSkip, "footnote", 0, fFalse, kwdDest, idestSkip, "ftncn", 0, fFalse, kwdDest, idestSkip, "ftnsep", 0, fFalse, kwdDest, idestSkip, "ftnsepc", 0, fFalse, kwdDest, idestSkip, "header", 0, fFalse, kwdDest, idestSkip, "headerf", 0, fFalse, kwdDest, idestSkip, "headerl", 0, fFalse, kwdDest, idestSkip, "headerr", 0, fFalse, kwdDest, idestSkip, "info", 0, fFalse, kwdDest, idestSkip, "keywords", 0, fFalse, kwdDest, idestSkip, "operator", 0, fFalse, kwdDest, idestSkip, "pict", 0, fFalse, kwdDest, idestSkip, "printim", 0, fFalse, kwdDest, idestSkip, "private1", 0, fFalse, kwdDest, idestSkip, "revtim", 0, fFalse, kwdDest, idestSkip, "rxe", 0, fFalse, kwdDest, idestSkip, "stylesheet", 0, fFalse, kwdDest, idestSkip, "subject", 0, fFalse, kwdDest, idestSkip, "tc", 0, fFalse, kwdDest, idestSkip, "title", 0, fFalse, kwdDest, idestSkip, "txe", 0, fFalse, kwdDest, idestSkip, "xe", 0, fFalse, kwdDest, idestSkip, "{", 0, fFalse, kwdChar, '{', "}", 0, fFalse, kwdChar, '}', "\\", 0, fFalse, kwdChar, '\\' }; int isymMax = sizeof(rgsymRtf) / sizeof(SYM); // // %%Function: ecApplyPropChange // // Set the property identified by _iprop_ to the value _val_. // // int ecApplyPropChange(IPROP iprop, int val) { char *pb; if (rds == rdsSkip) // If we're skipping text, return ecOK; // don't do anything. switch (rgprop[iprop].prop) { case propDop: pb = (char *)&dop; break; case propSep: pb = (char *)&sep; break; case propPap: pb = (char *)&pap; break; case propChp: pb = (char *)&chp; break; default: if (rgprop[iprop].actn != actnSpec) return ecBadTable; break; } switch (rgprop[iprop].actn) { case actnByte: pb[rgprop[iprop].offset] = (unsigned char) val; break; case actnWord: (*(int *) (pb+rgprop[iprop].offset)) = val; break; case actnSpec: return ecParseSpecialProperty(iprop, val); break; default: return ecBadTable; } return ecOK; } // // %%Function: ecParseSpecialProperty // // Set a property that requires code to evaluate. // int ecParseSpecialProperty(IPROP iprop, int val) { switch (iprop) { case ipropPard: memset(&pap, 0, sizeof(pap)); return ecOK; case ipropPlain: memset(&chp, 0, sizeof(chp)); return ecOK; case ipropSectd: memset(&sep, 0, sizeof(sep)); return ecOK; default: return ecBadTable; } return ecBadTable; } // // %%Function: ecTranslateKeyword. // // Step 3. // Search rgsymRtf for szKeyword and evaluate it appropriately. // // Inputs: // szKeyword: The RTF control to evaluate. // param: The parameter of the RTF control. // fParam: fTrue if the control had a parameter; (that is, if param is valid) // fFalse if it did not. // int ecTranslateKeyword(char *szKeyword, int param, bool fParam) { int isym; // search for szKeyword in rgsymRtf for (isym = 0; isym < isymMax; isym++) if (strcmp(szKeyword, rgsymRtf[isym].szKeyword) == 0) break; if (isym == isymMax) // control word not found { if (fSkipDestIfUnk) // if this is a new destination rds = rdsSkip; // skip the destination // else just discard it fSkipDestIfUnk = fFalse; return ecOK; } // found it! use kwd and idx to determine what to do with it. fSkipDestIfUnk = fFalse; switch (rgsymRtf[isym].kwd) { case kwdProp: if (rgsymRtf[isym].fPassDflt || !fParam) param = rgsymRtf[isym].dflt; return ecApplyPropChange(rgsymRtf[isym].idx, param); case kwdChar: return ecParseChar(rgsymRtf[isym].idx); case kwdDest: return ecChangeDest(rgsymRtf[isym].idx); case kwdSpec: return ecParseSpecialKeyword(rgsymRtf[isym].idx); default: return ecBadTable; } return ecBadTable; } // // %%Function: ecChangeDest // // Change to the destination specified by idest. // There's usually more to do here than this... // int ecChangeDest(IDEST idest) { if (rds == rdsSkip) // if we're skipping text, return ecOK; // don't do anything switch (idest) { default: rds = rdsSkip; // when in doubt, skip it... break; } return ecOK; } // // %%Function: ecEndGroupAction // // The destination specified by rds is coming to a close. // If there's any cleanup that needs to be done, do it now. // int ecEndGroupAction(RDS rds) { return ecOK; } // // %%Function: ecParseSpecialKeyword // // Evaluate an RTF control that needs special processing. // int ecParseSpecialKeyword(IPFN ipfn) { if (rds == rdsSkip && ipfn != ipfnBin) // if we're skipping, and it's not return ecOK; // the \bin keyword, ignore it. switch (ipfn) { case ipfnBin: ris = risBin; cbBin = lParam; break; case ipfnSkipDest: fSkipDestIfUnk = fTrue; break; case ipfnHex: ris = risHex; break; default: return ecBadTable; } return ecOK; }
rtfreadr.exe: rtfactn.obj rtfreadr.obj link rtfreadr.obj rtfactn.obj <nul rtfactn.obj: rtfactn.c rtfdecl.h rtftype.h rtfreadr.obj: rtfreadr.c rtfdecl.h rtftype.h
This appendix contains the changes to the Rich Text Format (RTF) specification for the Japanese version of Word (all platforms). In this section, Word J refers to the Japanese version of Word and RTF-J refers to the RTF specification described below. This document also contains some information about the interpretation of RTF-J and some behaviors of Word J.
This appendix is meant to be used in conjunction with the full RTF specification, assumes you have read the rest of this document, and does not contain the necessary information to implement an RTF reader or writer by itself. If you have any questions, please refer to the main specification first.
There is a Japanese local RTF specification, called RTF-J, that is somewhat different from the standard RTF specification. Although Word 7.0 J does not write RTF-J, it can read RTF-J files. It retains the text strings in the file and disregards unknown control words.
An escape expression (for example, \'hh, \\, or \{) is usable in all RTF control words.
Writer:
In general RTF should be written out with all characters above 0x80 in the escaped form, \'hh.
Character code | Write out as |
0x00 <= ch < 0x20 | Escaped (\'hh) |
0x20 <= ch < 0x80 | Raw (non-escaped) character |
0x80 <= ch <= 0xFF | Escaped (\'hh) |
For compatibility, there is an RTFParam option in the HKEY_CURRENT_USERF\Software\Microsoft\Word\7.0FE\ section of the registry database that determines whether raw 8-bit characters or escaped characters are used for the double-byte characters in \stylesheet, \fonttbl, \bkmkstart, and \bkmkend. This option is valid only when writing out the RTF; it does not affect RTF reading behavior.
[Microsoft Word] RTFParam=7 (the default) uses an escaped expression when the character is above 0x80. RTFParam=8 uses raw 8-bit characters for \stylesheet, \fonttbl, \bkmkstart, and \bkmkend (does not escape even if trailing-byte was an RTF special character such as \, {, or }).
Reader:
When the RTF reader encounters raw characters in the leading-byte range of the double-byte character, it regards the next character as the trailing byte of the double-byte character and combines the two characters into one double-byte character.
Leading byte | Trailing byte | Validity |
Escaped | Raw (0x20 <= ch <= 0x7f) | Valid (standard format for double-byte character) |
Escaped | Escaped (other) | Valid (standard format for double-byte character) |
Raw | Raw | Valid (RTF-J format for double-byte character) |
Raw | Escaped | Invalid |
Word J specifies the character set in the font table using \fcharset. Word J interprets \cpg437 as \fcharset0 and \cpg932 as \fcharset128 if it encounters these control words when reading RTF. If both \fcharset and \cpg appear in the font table, \cpg is ignored.
Word maps single-byte characters according to character set information (for example, Macintosh to ANSI) and leaves double-byte characters unmapped.
RTF-J control words | Definition and the interpretation in Word |
---|---|
\jis | RTF-J uses \jis as a control word for character set. Word J interprets this as \ansi, which is the default character set used if the character set is not defined. |
\fjminchou and \fjgothic | RTF-J uses \fjminchou and \fjgothic to specify font family. Word J interprets these as \fnil, which is the default font family. |
If \cpg or \fcharset control words are not present, Word J uses the text metrics of the font before determining the character set of these fonts. If the font is unknown, Word J assumes it is SHIFTJIS_CHARSET.
Word J defines control words to specify composite fonts as associated character properties. These control words follow the rule of associated character properties and understand font designation (\af). All other <aprops> are ignored in Word J.
<atext> | <losbrun> | <hisbrun> | <dbrun> |
<losbrun> | \hich \af & <aprops> \dbch \af & <aprops> \loch <ptext> |
<hisbrun> | \loch \af & <aprops> \dbch \af & <aprops> \hich <ptext> |
<dbrun> | \loch \af & <aprops> \hich \af & <aprops> \dbch <ptext> |
Control word | Definition |
---|---|
\loch | Specifies a run of the characters in the low-ANSI (0x00-0x7F) area. |
\hich | For the characters in the high-ANSI (0x80--0xFF) area. |
\dbch | Specifies a run of the double-byte characters. |
Word J writes out associated character properties in the styles. In the style sheet, the <dbrun> definition should be used for compatibility with applications that have transparent readers.
{\stylesheet{\loch\af5\hich\af5\dbch\f27\fs20\snext0 Normal;}}
If the composite font definition matches the style, only the control word (\loch, \hich, or \dbch) will be used to distinguish the type of run, along with the font information for transparent readers.
{\fonttbl{\f5\fswiss\fcharset0\fprq2 Arial;}{\f27\froman\fcharset128\fprq1 Mincho;}} {\stylesheet{\loch\af5\hich\af5\dbch\f27\fs20\snext0 Normal;}} \pard\plain {\dbch\f27\fs20 \'82\'b1\'82\'ea\'82\'cd} {\loch\f5 Test } {\dbch\f27\'82\'c5\'82\'b7\'81B} \par}
If one or all of \loch, \hich, and \dbch are missing from the style sheet definition (or the character set doesn't match), Word J will apply appropriate fonts to each character run in the style using the bulleted rules below.
Control word | Font that Word J will apply |
\loch | Same font as \f. |
\hich | Any font whose character set is ANSI_CHARSET. |
\dbch | Any font whose character set is SHIFTJIS_CHARSET. |
If the composite font control words are missing from the character run, Word J will interpret all characters below 0x80 as a \loch run. Characters above or equal to 0x80 will be determined using the following rules:
If the character is in the leading-byte range and the next character is in the trailing-byte range of a double-byte character, it will be treated as a \dbch run (one double-byte character). For example:
\'99\'47à
If the character is in the leading-byte range of a double-byte character but the next character is not in the trailing-byte range, it will be treated as a \hich run (two high-ANSI or low-ANSI characters). For example:
\'99\'FFàÿ
If the character is in the leading-byte range of a double-byte character and is the last character in the run, it will be treated as a \hich run (one high-ANSI character). For example:
\'99\parà
If the character is not in the leading-byte range of a double-byte character, it will be treated as a \hich run (one high-ANSI character). For example:
\'FFàÿ
Control word | Description |
---|---|
Associated Character Properties |
|
\loch | The text consists of single-byte low-ANSI (0x00-0x7F) characters. |
\hich | The text consists of single-byte high-ANSI (0x80-0xFF) characters. |
\dbch | The text consists of double-byte characters. |
Borders |
|
\brdrdash | Dashed border. |
\brdrdashd | Dash-dotted border. |
\brdrdashdd | Dash-dot-dotted border. |
Character Properties |
|
\uldash | Dashed underline. |
\uldashd | Dash-dotted underline. |
\uldashdd | Dash-dot-dotted underline. |
\ulhair | Hairline underline. |
\ulth | Thick underline. |
\ulwave | Wave underline. |
\accnone | No accent characters (over dot / over comma). |
\accdot | Over dot accent. |
\acccomma | Over comma accent. |
\charscalex | Character width scaling. |
\striked | Double strikethrough. |
Document Formatting Properties |
|
\horzdoc | Horizontal rendering. |
\vertdoc | Vertical rendering. |
\*\fchars | List of following kinsoku characters. |
\*\lchars | List of leading kinsoku characters. |
\jcompress | Compressing justification (default). |
\jexpand | Expanding justification. |
\gutterprl | Parallel gutter. |
\dgsnap | Snap to grid. |
\dghspaceN | Grid horizontal spacing in twips (the default is 120). |
\dgvspaceN | Grid vertical spacing in twips (the default is 120). |
\dghoriginN | Grid horizontal origin in twips (the default is 1701). |
\dgvoriginN | Grid vertical origin in twips (the default is 1984). |
\dghshowN | Show Nth horizontal grid (the default is 3). |
\dgvshowN | Show Nth vertical grid (the default is 0). |
\twoonone | Print two logical pages on one physical page. |
\lnongrid | Define line based on the grid. |
Bullets and Numbering |
|
\pndecd | Double-byte decimal numbering (\*arabic\*dbchar). |
\pndbnum | Kanji numbering without the digit character (\*dbnum1). |
\pnaiu | 46 phonetic katakana characters in "aiueo" order (\*aiueo). |
\pnaiud | 46 phonetic double-byte katakana characters (\*aiueo\*dbchar). |
\pniroha | 46 phonetic katakana characters in "iroha" order (\*iroha). |
\pnirohad | 46 phonetic double-byte katakana characters (\*iroha\*dbchar). |
\pncnum | 20 numbered list in circle (\*circlenum). |
\pnuldash | Dashed underline. |
\pnuldashd | Dash-dotted underline. |
\pnuldashdd | Dash-dot-dotted underline. |
\pnulhair | Hairline underline. |
\pnulth | Thick underline. |
\pnulwave | Wave underline. |
Drawing Objects |
|
\dptxlrtb | Text box flows from left to right and top to bottom (default). |
\dptxtbrl | Text box flows from right to left and top to bottom. |
\dptxbtlr | Text box flows from left to right and bottom to top. |
\dptxlrtbv | Text box flows from left to right and top to bottom, vertically. |
\dptxtbrlv | Text box flows from top to bottom and right to left, vertically. |
Frame Properties |
|
\frmtxlrtb | Frame box flows from left to right and top to bottom (default). |
\frmtxtbrl | Frame box flows right to left and top to bottom. |
\frmtxbtlr | Frame box flows left to right and bottom to top. |
\frmtxlrtbv | Frame box flows left to right and top to bottom, vertical. |
\frmtxtbrlv | Frame box flows top to bottom and right to left, vertical. |
Index Entries |
|
\*\pxe | "Yomi" (pronunciation) for index entry. |
Paragraph Properties |
|
\nocwrap | No character wrapping. |
\nowwrap | No word wrapping. |
\qd | Distributed. |
\nooverflow | No overflow period and comma. |
\aspalpha | Auto spacing between DBC and English. |
\aspnum | Auto spacing between DBC and numbers. |
\fahang | Font alignment -> Hanging. |
\facenter | Font alignment -> Center. |
\faroman | Font alignment -> Roman (default). |
\favar | Font alignment -> Upholding variable. |
\fafixed | Font alignment -> Upholding fixed. |
Section Formatting Properties |
|
\horzsect | Horizontal rendering. |
\vertsect | Vertical rendering. |
\pgndecd | Double-byte decimal numbering. |
\pgndbnum | Kanji numbering without the digit character. |
\pgndbnumd | Kanji numbering with the digit character. |
Special Characters |
|
\zwbo | Zero-width break opportunity. Used to insert break opportunity between two characters. |
\zwnbo | Zero-width nonbreak opportunity. Used to remove break opportunity between two characters. |
\qmspace | One-quarter em space. |
Table Formatting |
|
\clbrdrdtlcldglu | Diagonal line (top left to bottom right). |
\clbrdrdtr\cldgll | Diagonal line (top right to bottom left). |
\cltxlrtb | Text in a cell flows from left to right and top to bottom (default). |
\cltxtbrl | Text in a cell flows right to left and top to bottom. |
\cltxbtlr | Text in a cell flows left to right and bottom to top. |
\cltxlrtbv | Text in a cell flows left to right and top to bottom, vertical. |
\cltxtbrlv | Text in a cell flows top to bottom and right to left, vertical. |
\clvmgf | The first cell in a range of table cells to be vertically merged. |
\clvmrg | Contents of the table cell are vertically merged with those of the preceding cell. |
\clvertalt | Cell top align. |
\clvertalc | Cell vertically center align. |
\clvertalb | Cell bottom align. |
Tabs |
|
\tlmdot | Leader middle dots. |
Control word | Meaning |
---|---|
Character Formatting Properties |
|
\cgridN | Character grid. |
\g | Destination related to character grids. |
\gcw | Grid column width. |
\gridtbl | Destination keyword related to character grids. |
\nosectexpand | Disable character space basement. |
Paragraph Formatting Properties |
|
\nosnaplinegrid | Disable snap line to grid. |
\faauto | Font alignment the default setting for this is "Auto." |
Borders |
|
\brdrframe | Border resembles a "Frame." |
Bullets and Numbers |
|
\pnaiueo | 46 phonetic Katakana characters in "aiueo" order (*aiueo). |
\pnaiueod | 46 phonetic double-byte Katakana characters (*aiueo*dbchar). |
\pndbnumd | Kanji numbering with the digit character (*dbnum2). |
\pndbnumt | Kanji numbering 3 (*dbnum3). |
\pndbnuml | Kanji numbering 3 (*dbnum3). |
\pndbnumk | Kanji numbering 4 (*dbnum4). |
\pnganada | Korean numbering 2 (*ganada). |
\pngbnum | Chinese numbering 1 (*gb1). |
\pngbnumd | Chinese numbering 2 (*gb2). |
\pngbnuml | Chinese numbering 3 (*gb3). |
\pngbnumk | Chinese numbering 4 (*gb4). |
\pnzodiac | Chinese Zodiac numbering 1 (*zodiac1). |
\pnzodiacd | Chinese Zodiac numbering 2 (*zodiac2). |
\pnzodiacl | Chinese Zodiac numbering 3 (*zodiac3). |
\pnganada | Korean numbering 1 (*ganada). |
\pnchosung | Korean numbering 2 (*chosung). |
Endnotes and Footnotes |
|
\ftnnchosung | Footnote Korean numbering 1 (*chosung). |
\ftnncnum | Footnote Circle numbering (*circlenum). |
\ftnndbnum | Foonote Kanji numbering without the digit character (*dbnum1). |
\ftnndbnumd | Footnote Kanji numbering with the digit character (*dbnum2). |
\ftnndbnumt | Footnote Kanji numbering 3 (*dbnum3). |
\ftnndbnumk | Footnote Kanji numbering 4 (*dbnum4). |
\ftnndbar | Footnote double-byte numbering (*dbchar). |
\ftnnganada | Footnote Korean numbering 2 (*ganada). |
\ftnngbnum | Footnote Chinese numbering 1 (*gb1). |
\ftnngbnumd | Footnote Chinese numbering 2 (*gb2). |
\ftnngbnuml | Footnote Chinese numbering 3 (*gb3). |
\ftnngbnumk | Footnote Chinese numbering 4 (*gb4). |
\ftnnzodiac | Footnote numbering-- Chinese Zodiac numbering 1 (* zodiac1)
|
\ftnnzodiacd | Footnote numbering-- Chinese Zodiac numbering 2 (* zodiac2)
|
\ftnnzodiacl | Footnote numbering-- Chinese Zodiac numbering 3 (* zodiac3). |
\aftnnchosung | Endnote Korean numbering 1 (*chosung). |
\aftnncnum | Endnote Circle numbering (*circlenum). |
\aftnndbnum | Endnote Kanji numbering without the digit character (*dbnum1). |
\aftnndbnumd | Endnote Kanji numbering with the digit character (*dbnum2). |
\aftnndbnumt | Endnote Kanji numbering 3 (*dbnum3). |
\aftnndbnumk | Endnote Kanji numbering 4 (*dbnum4). |
\aftnndbar | Endnote double-byte numbering (*dbchar). |
\aftnnganada | Endnote Korean numbering 2 (*ganada). |
\aftnngbnum | Endnote Chinese numbering 1 (*gb1). |
\aftnngbnumd | Endnote Chinese numbering 2 (*gb2). |
\aftnngbnuml | Endnote Chinese numbering 3 (*gb3). |
\aftnngbnumk | Endnote Chinese numbering 4 (*gb4). |
\aftnnzodiac | Endnote numbering-- Chinese Zodiac numbering 1 (* zodiac1)
|
\aftnnzodiacd | Endnote numbering-- Chinese Zodiac numbering 2 (* zodiac2)
|
\aftnnzodiacl | Endnote numbering-- Chinese Zodiac numbering 3 (* zodiac3). |
Section Formatting Properties |
|
\pgnchosung | Korean numbering 1 (* chosung). |
\pgncnum | Circle numbering (*circlenum). |
\pgndbnumt | Kanji numbering 3 (*dbnum3). |
\pgndbnumk | Kanji numbering 4 (*dbnum4). |
\pgnganada | Korean numbering 2 (*ganada) |
\pgngbnum | Chinese numbering 1 (*gb1). |
\pgngbnumd | Chinese numbering 2 (*gb2). |
\pgngbnuml | Chinese numbering 3 (*gb3). |
\pgngbnumk | Chinese numbering 4 (*gb4). |
\pgnzodiac | Chinese Zodiac numbering 1 (*zodiac1). |
\pgnzodiacd | Chinese Zodiac numbering 2 (*zodiac2). |
\pgnzodiacl | Chinese Zodiac numbering 3 (*zodiac3). |
\sectexpandN | Character space basement. |
\sectlinegridN | Line grid. |
\sectdefaultclN | Default state of section. Indicates \sectspecifyclN and \sectspecifylN are not emitted. |
\sectspecifyclN | Specify number of characters per line only. |
\sectspecifylN | Specify both number of characters per line and number of lines per page. |
\adjustright | Adjust right indent. |
Document Formatting Properties |
|
\dgmargin | Grid to follow margins. |
Index Entries |
|
\yxe | Pronunciation for index entry. |
The following table contains a list of each RTF control word, the name of the section where it may be found, and a brief description of the type of control word. The types are described in the following table.
Type | Description |
---|---|
Flag | This control word ignores any parameter. |
Destination | This control word starts a group or destination. It ignores any parameter. |
Symbol | This control word represents a special character. |
Toggle | This control word distinguishes between the ON and OFF states for the given property. The control word with no parameter or a nonzero parameter is used to turn on the property, while the control word with a zero parameter is used to turn it off. |
Value | This control word requires a parameter. |
Note In the following comprehensive table, the names of all control words that are new to Microsoft Word version 7.0 are followed by an asterisk (*) and the names of all control words that are new to Microsoft Word 97 are followed by two asterisks (**).
The disk and software contained on it, including any accompanying documentation (the "Software"), are provided to you at no additional charge. Microsoft Corporation owns all rights, title, and interest in and to the Software. The user assumes the entire risk as to the accuracy and the use of the Software.
COPYRIGHT NOTICE. Copyright © 1995-1997 Microsoft Corporation. Microsoft and/or its suppliers, One Microsoft Way, Redmond, Washington 98052-6399 U.S.A. All rights reserved.
TRADEMARKS. Microsoft, Windows, Windows NT, MSN, The Microsoft Network and/or other Microsoft products referenced herein are either trademarks or registered trademarks of Microsoft. Other product and company names mentioned herein may be the trademarks of their respective owners.
The names of companies, products, people, characters and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product or event, unless otherwise noted.
NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MICROSOFT OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBLITY OF SUCH DAMAGES. BECAUSE SOME STATES AND JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY. MICROSOFT'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY UNDER THIS EULA SHALL NOT EXCEED FIVE DOLLARS (US$5.00).
The following conditions also apply to your use of the Software:
The Software may be copied and distributed internally only, subject to the following conditions:
All text must be copied without modification and all pages must be included;
If software is included, all files on the disk(s) |must be copied without modification [the MS-DOS(R) utility diskcopy is appropriate for this purpose];
All components of this Software must be distributed together; and
This Software may not be distributed to any third party.
If you are not a Microsoft Premier customer, Microsoft shall not provide technical support for this Software.
The Software is provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation, One Microsoft Way, Redmond, WA 98052-6399. Any transfer of the Software must be accompanied by this statement and may only be transferred if first approved by Microsoft.
You agree that you will not export or re-export the Software to any country, person, entity or end user subject to U.S.A. export restrictions, and you are responsible for complying with all applicable U.S. and local export laws in connection with the use of this Software. You warrant and represent that neither the U.S.A. Bureau of Export Administration nor any other federal agency has suspended, revoked or denied you export privileges.
This EULA is governed by the laws of the State of Washington, U.S.A.