Microsoft KB Archive/922681

= Description of the changes to the Rich Text Format (RTF) Specification, version 1.8 for Word =

Article ID: 922681

Article Last Modified on 8/18/2006

-

APPLIES TO


 * Microsoft Office Word 2003
 * Microsoft Word 2002 Standard Edition

-



INTRODUCTION
This article describes the keyword changes to the Rich Text Format (RTF) Specification, version 1.8 for Microsoft Word.

The changes described in this article are included in security bulletin 917336. However, these changes are not related to the security bulletin. For more information about security bulletin 917336, click the following article number to view the article in the Microsoft Knowledge Base:

917336 MS06-027: Vulnerability in Microsoft Word could allow remote code execution



MORE INFORMATION
In the RTF Specification, version 1.8, some keywords are newly added, and some keywords are now used differently. The following sections describe these keywords.

Headers and footers
In earlier versions of the RTF Specification, only the \footer keyword or the \header keyword was written if the &quot;Facing pages&quot; option was disabled. Additionally, only the \headerl and \headerr keywords for the left and right headers, respectively, were written if the &quot;Facing pages&quot; option was enabled.

Because of the changes to the RTF Specification, the \headerl keyword and the \headerr keyword are always written. Additionally, the \headerr keyword is written as the header on every page if the &quot;Facing pages&quot; option is disabled.

Mail merge
Mail merge refers to an operation by which RTF documents work together with data from an external data source, importing the data into a document according to a set of codes that are contained in RTF tags that are also known as fields (\field).

An RTF document that contains the \*\mailmerge control word is connected to an external data source. This document is known as a source document. In addition to being connected to an external data source and containing fields, a source document may contain any regular RTF constructs. These include the following:
 * Character text
 * Paragraphs
 * Images
 * Tables
 * Lists

The two key parts of the mail merge data that are stored in a RTF document:
 * The information that connects the document to the external data source
 * The information that populates the fields in the document with external data

Once the fields in a mail merge document have been populated with external data, the mail merge process is complete. The resulting files are known as mail merged documents or simply merged documents.

The following table lists the keywords that are already documented in the RTF Specification for mail merge documents.

For example, consider the mail merge scenario in which an RTF document is connected to an external data source that is named &quot;ExampleExternalDataSource.xls&quot; and that is located on the user's desktop. {\*\mailmerge\mmmaintypeletters\mmlinktoquery\mmdatatypeodso{\*\mmconnectstrdata #SDATA}

{\mmquery SELECT * FROM `Sheet1$`}{\mmdatasource C:\\Documents and Settings\\Desktop\\ExampleExternalDataSource.xls} \mmdestnewdoc\mmreccur1\mmerrors2{\*\mmodso{\*\mmodsoudldata #SDATA}

{\mmodsotable Sheet1$}{\mmodsosrc C:\\Documents and Settings\\Desktop\\ExampleExternalDataSource.xls} {\*\mmodsofilter }{\*\mmodsosort }{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033} {\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Title}

{\mmodsomappedname Courtesy Title}\mmodsofmcolumn0\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname First Name} {\mmodsomappedname First Name}\mmodsofmcolumn1\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}

{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Last Name}{\mmodsomappedname Last Name}\mmodsofmcolumn2\mmodsolid1033} {\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}

{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Company Name} {\mmodsomappedname Company}\mmodsofmcolumn3\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Address Line 1} {\mmodsomappedname Address 1}\mmodsofmcolumn4\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Address Line 2} {\mmodsomappedname Address 2}\mmodsofmcolumn5\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname City}{\mmodsomappedname City}

\mmodsofmcolumn6\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname State}{\mmodsomappedname State}\mmodsofmcolumn7\mmodsolid1033} {\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname ZIP Code}{\mmodsomappedname Postal Code}

\mmodsofmcolumn8\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Country} {\mmodsomappedname Country or Region}\mmodsofmcolumn9\mmodsolid1033} {\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Work Phone}{\mmodsomappedname Business Phone}

\mmodsofmcolumn11\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033} {\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname Home Phone} {\mmodsomappedname Home Phone}\mmodsofmcolumn10\mmodsolid1033}

{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}{\*\mmodsofldmpdata\mmfttypedbcolumn{\mmodsoname E-mail Address} {\mmodsomappedname E-mail Address}\mmodsofmcolumn12\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}

{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033} {\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033} {\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}

{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}{\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033} {\*\mmodsofldmpdata\mmodsofmcolumn-1\mmodsolid1033}\mmodsocoldelim9\mmjdsotype1\mmodsofhdr1}}

Mail merge field map data type

This specifies the data type of the mapped mail merge field.

Mail merge destination

This specifies the possible results that may be generated when a mail merge is carried out on a given RTF source document. In other words, this control word is used to specify what is to be done with the merged documents that result from populating the fields in a given merged RTF document with data from the specified external data source.

Types of mail merge source documents

This specifies the mail merge main document &quot;document type.&quot;

Types of mail merge data types

This specifies the possible values for the types of external data sources to be connected to via the Dynamic Data Exchange (DDE) system (such as a spreadsheet or a database) or the alternative method of data access if the Dynamic Data Exchange system is not used.

Document protection

This specifies the write protection settings that have been applied to this document. Write protection refers to a mode in which the document's contents cannot be edited. Additionally, the document cannot be resaved by using the same file name.

OLE

The \*\objclass control word introduces OLE objects. OLE allows objects such as spreadsheets, images, documents, and so on to be embedded in an RTF document.

Additional new control words

The following table lists the new control words that are added to mail merge.

XML Namespace table
XML Namespace tables contain the Namespaces for XML and SmartTags that are used in an RTF-formatted document.

SmartTags and custom XML markup each provide a facility for embedding customer-defined semantics into the document as follows:
 * SmartTags use the ability to provide a basic Namespace or Name for a run or set of runs in a document
 * Custom XML markup uses the ability to tag the document that uses XML elements and attributes that are specified by any valid XML Schema file.

The following table lists the new Namespace Table keywords that have been added for XML tags and SmartTags.

An example of usage is as follows: {\*\xmlnstbl{\xmlns1 { HYPERLINK &quot;http://exmapleuri.org&quot; }}}

SmartTag data to RTF
SmartTags provide a facility for embedding customer-defined semantics into the document by using the ability to provide a basic Namespace or Name for a run or set of runs in a document.

The following table lists the new keywords that have been added to convert SmartTag data to RTF.

An example of usage is as follows: {\*\xmlopen\xmlns2{\factoidname date} {\xmlattr\xmlattrns0{\xmlattrname Month}{\xmlattrvalue 4}} {\xmlattr\xmlattrns0{\xmlattrname Day}{\xmlattrvalue 11}} {\xmlattr\xmlattrns0{\xmlattrname Year}{\xmlattrvalue 2006}}}4/11/2006} {\*\xmlclose}

Document password to modify or to protect forms
The following table lists the new keyword that is added to modify or to protect forms.

An example of usage is as follows: {\*\password 00000000}

New keywords for existing properties
The following table lists the new keywords that are added for existing properties.

Complex script keywords
The following table lists keywords that are already documented in the RTF Specification. However, the following keywords are now written more frequently.

