2.1 Encapsulating RTF Writer Algorithm Details

Encapsulation enables storage of the HTML or plain text content of a document in the body of another RTF document. <1> Encapsulation leverages native RTF such that an RTF reader can render the RTF representation of the document without any indication of embedded content and, when de-encapsulated, the HTML and plain text will differ only minimally from the original HTML or plain text content.

To encapsulate HTML or plain text document content inside an RTF document, the RTF writer uses two extensibility features of RTF, as described in [MSFT-RTF]:

  1. RTF control words unknown to an RTF reader have to be ignored by the RTF reader. The HTML/plain text encapsulation format specified by this algorithm defines new RTF control words, as specified in section 2.1.3.1. RTF control words are described in [MSFT-RTF].

  2. Ignorable RTF destinations (that is, RTF groups that start with "{\*\<destination-name>" and end with "}") have to be skipped (not rendered in any form) by any RTF reader that does not recognize the <destination-name>. The HTML/plain text encapsulation format specified by this algorithm defines new RTF destinations for encapsulating original or rewritten HTML markup, as specified in section 2.1.

An implementer of this algorithm has to have a good understanding of RTF, as specified in [MSFT-RTF], and HTML, as specified in [HTML], to create RTF content that sufficiently represents the original HTML or plain text content, and to encapsulate plain text or HTML in such RTF.