Rich Text Format (RTF) Chinese Version Specification, Version 1.6

xiaoxiao2021-03-06  89

Introduction RTF syntax RTF viewer agreed form syntax RTF file content head RTF version character set Unicode RTF font table file table color table style table list symbol table Tracking change (revision tag)

Document Zone Information Group Wenchitectural Property Chapter Text Paragraph Text Character Text Document Variable Bookmark Image Object Drawing Object Word 97-2000 RTF for Drawing Objects (Shapes) Footnotes Note Fields Form Fields Index Project Bilingual Language Support

Asian Language Support Appendix A: Sample RTF Reader Application How To Write An RTF Reader A Sample RTF Reader Implementation Notes ON Implementing Other RTF Features Other Problem Areas in RTF

Appendix B: Index of RTF Control Words Appendix C: Control Words IntroducesD by Other Microsoft Products Pocket Word Exchange (Used in RTF <-> HTML Conversions)

Introduction

The Rich Text Format (RTF) specification is a simple encoding method for formatting text and graphics in application. Currently, users rely on special conversion software to convert word processing documents between MS-DOSTM, MicrosoftTM WindowsTM, OS / 2, Macintoshtm, and Power Macintoshtm applications. The Rich Text Format (RTF) Specification is a method of encoding formatted text and graphics for easy transfer between applications. Currently, users depend on special translation software to move word-processing documents between different MS-DOSTM, MicrosoftTM WindowsTM, OS / 2, Macintoshtm, And Power Macintoshtm Applications.

The RTF specification provides an interactive text and graphics format that can be used on different output devices, operating environments, and operating systems. RTF uses the US National Standardization Organization (ANSI), the PC-8, Macintosh, or the character set of the IBM PC to control the appearance and format of the document, regardless of whether the document is displayed on the screen or is printed from the printer. Due to the RTF specification, different operating systems, documents created by different software can be identified in other operating systems and programs. The RTF file created by the Macintoch and Power Macintosh version of the Word 6.0 (and later) provides a file type - "RTF". The RTF Specification provides a format for text and graphics interchange that can be used with different output devices, operating environments, and operating systems. RTF uses the American National Standards Institute (ANSI), PC-8, Macintosh, or IBM PC character set to control the representation and formatting of a document, both on the screen and in print. with the RTF Specification, documents created under different operating systems and with different software applications can be transferred between those operating systems and applications. RTF files created in Word 6.0 ( AND Later) The software that converts a formatted file into the RTF file into an editor. An RTF editor separates the control information of the existing text in the original program and generates a new file containing the original text and the RTF group. Convert an RTF file into a formatted file called a viewer. Software that takes a formatted file and turns it into an RTF file is called a writer. An RTF writer separates the application's control information from the actual text and writes a new file containing the text and the RTF groups associated with that text. Software that translates An RTF File Into a formatted file is called a reader.

Here is an example of an RTF viewer (read the appendix A: RTF Viewer program example). It is designed for this specification. I hope it is helpful for developers who are interested in developing their own RTF viewers. Appendix A describes the structure and usage of this program. This RTF viewer is not a commercial product, Microsoft does not provide technical and other forms of support for RTF viewer code and RTF specifications. For more information on how to download this example from the Microsoft Download Center, visit the following web address: www.microsoft.com/downloads/search.asp and search "RTF Reader". A sample RTF reader application is available. (See the Appendix A: Sample RTF Reader Application section of this document) It is designed for use with the specification to assist those interested in developing their own RTF readers This application and its use are described in. Appendix A. 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. for more information on how to download the sample RTF reader from the Microsoft Download Center, please visit the following Web address: www.microsoft.com/downloads/search.asp and then search on "RTF Reader." RTF version 1.6 includes all the Microsoft Word for Windows 95 v7.0, Word 97 for Windows, Word 98 for the Macintosh, And Word 2000 for Windows, also includes new control words described in Microsoft Other products. RTF Version 1.6 Include All New Control Words Introducted by Microsoft Word for Windows 95 Version 7.0, Word 97 for Windows, Word 98 for the Macintosh, And Word 2000 for Windows, AS Well As Other Microsoft Products.

RTF syntax

An RTF file consists of unformatted text, control word, control symbol, and group. For more easily conversion, a standard RTF file should only contain 7 bits ASCII code characters. The RTF file does not limit the maximum length of the row of the file. (Primel: MaxImun LINE LENGTH is the number of characters that guide or refer to the number of lines of documents?) AN RTF File Consists of Unformatted Text, Control Words, Control Symbols, And Groups. For Ease of Transport, A Standard RTF File Can Consist Of only 7-bit ASCII characters. (Converters that communicate with Microsoft word for Windows or Microsoft word for the Macintosh should expect 8-bit characters.) There is no set maximum line length for an RTF file. control is a special word of RTF The formatted command used to mark the printer control is also a formatted information to manage the document style. (Primel: Word is not good.) A control word cannot exceed 32 characters. A control word takes the following form: A control word is a specially formatted command that RTF uses to mark printer control codes and information that applications use to manage documents A control word can not be longer than 32 characters A control word takes the following form..:

/ LetterSequern

Note that each control word begins with a backslash.

LetterSequence consists of lowercase letters characters (A-Z). RTF is sensitive.

Note A Backslash Begins Each Control Word.

The LettersEquern is Made Up of LowerCase Alphabetic Characters (A-Z). RTF is Case Sensitive.

The following Word 97-2000 keywords do not comply with the keywords mentioned above do not allow the requirements of any uppercase letters. All editors should still follow this rules, and the next version of Word will also be a keyword that completely uses lowercase letters. At the same time, it is recommended that those viewers will use the following keywords as exceptions:

/ ClFitText / clftsWidthN / clNoWrap / clwWidthN / tdfrmtxtBottomN / tdfrmtxtLeftN / tdfrmtxtRightN / tdfrmtxtTopN / trftsWidthAN / trftsWidthBN / trftsWidthN / trwWidthAN / trwWidthBN / trwWidthN / sectspecifygenN

The following Word 97-2000 keywords do not currently follow the requirement that keywords may not contain any uppercase alphabetic characters. All writers should still follow this rule, and Word will also emit completely lowercase versions of all these keywords in the next version. In the meantime, those implementing readers are advised to treat them as exceptions: / clFitText / clftsWidthN / clNoWrap / clwWidthN / tdfrmtxtBottomN / tdfrmtxtLeftN / tdfrmtxtRightN / tdfrmtxtTopN / trftsWidthAN / trftsWidthBN / trftsWidthN / trwWidthAN / trwWidthBN / trwWidthN / sectspecifygenN

The end of an RTF control word is marked by a separator, and the following characters can be used as a separator:

A space. In this case, the space is part of the keyword. A number or even characters (-) means it is a digital parameter. The length of this digital sequence is defined by one of the subsequent spaces or other characters in addition to letters and numbers. This parameter can be positive or negative, and its range range is usually from -32767 to 32767. However, the value range of Word can be reached from -31680 to 31680. Word allows the keyword of the key to value the value range in -2, 147, 483, 648 to 2, 147, 483, 648 (especially, / bin, / recdttm, and some image attributes). (Primel: A Small Number Of Keywords I don't know what these binaries should be referred to.) A RTF parser should be able to convert a random number string to a keyword. If a numeric parameter follows the control word, this parameter is part of the control word. At this time, the control word is separated by a space or non-alphanumeric character, and the same manner is separated by other control words. In addition to other characters of letters and numbers. In this case, this divider ends the control word, and it does not belong to a part of the control word.

The delimiter Marks The End of an RTF Control Word, And Can Be One of the Following:

A space In this case, the space is part of the control word A digit or a hyphen.. (-)., Which indicates that a numeric parameter follows The subsequent digital sequence is then delimited by a space or any character other than a letter or a digit. The parameter can be a positive or a negative number. The range of the values ​​for the number is generally -32767 through 32767. However, Word tends to restrict the range to -31680 through 31680. Word allows values ​​in the range -2,147,483,648 to 2,147,483,648 for a small number of keywords (specifically / bin, / revdttm, and some picture properties). An RTF parser must handle an arbitrary string of digits as a legal value for a keyword. If a numeric parameter immediately follows the control word, this parameter becomes part of the control word. The control word is then delimited by a space or a nonalphabetic or nonnumeric character in the same manner as any other control word.Any character other than a letter or a digit. in this case, The delimit ING Character Terminates The Control Word But In Not Actually Part of The Control Word. If it is the first case, space does not appear in the document. All characters after the separator, including spaces, will be written to a document. Based on this reason, you should use spaces in the case of need, don't just use spaces to separate RTF code. .. If a space delimits the control word, the space does not appear in the document Any characters following the delimiter, including spaces, will appear in the document For this reason, you should use spaces only where necessary; do not use spaces merely to Break Up RTF Code.

A control symbol consists of a backslash and a simple non-alphabetic character followed by it. For example, / ~ represents a non-wrap space. The control character does not require a separator. A Control Symbol Consists of a Backslash Followed by a Single, Nonalphabetic Character. For Example, / ~ Represents a nonbreaking space. Control Symbols Take No Delimiters.

The text and control word or control character enclosed by parentheses ({}) are composed of text and control characters. Left brackets ({) means the beginning of the group, and the right brackets means the end of the group. Each group sets the format of this text through its range and the different properties it contains. The RTF file can also include the following types of groups: font, style, screen color, pictures, footnotes, annotations, headers, and footer, summary, fields, and bookmarks. These groups can also have documentation, chapters, short, character formatting properties. If the font, files, styles, screen colors, revisions, and summary information groups contain document formatting properties, they must be defined before the first plain text. These groups constitute the head of the RTF file. If the font group exists, it should appear before the style group. If a group is not used in the file, then it will be ignored. The group will be discussed in detail in the following sections. A group consists of text and control words or control symbols enclosed in braces ({}). The opening brace ({) indicates the start of the group and the closing brace (}) indicates the end of the group. Each group specifies the text affected by the group and the different attributes of that text. The RTF file can also include groups for fonts, styles, screen color, pictures, footnotes, comments (annotations), headers and footers, summary information, fields, and bookmarks, as well as document-, section-, paragraph-, and character-formatting properties. If the font, file, style, screen-color, revision mark, and summary-information groups and document-formatting properties are included, they must precede the first plain -text character in the document. These groups form the RTF file header. If the group for fonts is included, it should precede the group for styles. If any group is not used, it can be omitted. The groups are discussed in the following SECTIONS.

A control word (such as bold, italic, butlamps, etc.) has only two states. When such a control word does not have a parameter or only one non-zero parameter, this control word is considered to open this property. When such a control word has a parameter and zero, it is considered that this control word cancels this property. For example, / b opens bold, reverse / b0 cancel bold. The control properties of certain control words (such as bold, italic, keep together, and so on) have only two states. When such a control word has no parameter or has a nonzero parameter, it is assumed that the control word turns on the Property. WHEN Such A Control Word Has A Parameter Of 0, It is Assumed That The Control Word Turns Off The Property. for Example, / B Turns on Bold, WHEREAS / B0 TURNS OFF BOLD. For a control word, And, marking a starting point with a relationship ... (prior to: This sentence is sweaty, if it is not too late as postgraduate translation, what do Destination? Target, destination, target cell? Think.). Targets can also be used but may not be present in the document. An example of the target: / footnote group, footnotes after the control word. Page fails cannot appear in the target text. The target control word and the text after they must be included within the braces. Other control characters or text cannot appear in the target group. The target added after the RTF specification described in the "Microsoft System Magazine" published in March 1987 should appear before / * control symbols. If the RTF viewer cannot identify the target, the control character will ignore the target of the relevant text. (The RTF editor should follow the add new target or group specification using the control symbol.) The target of the related text should be inserted into the document, even if the RTF viewer cannot identify the target, do not use / *. / * As part of the control word, is used with all the targets that are not included in the RTF specification revisions published in March 1987.

Certain control words, referred to as destinations, mark the beginning of a collection of related text that could appear at another position, or destination, within the document. Destinations may also be text that is used but should not appear within the document. An example of a destination is the / footnote group, where the footnote text follows the control word. Page breaks can not occur in destination text. Destination control words and their following text must be enclosed in braces. No other control words or text may appear within the destination group. Destinations added after the RTF Specification published in the March 1987 Microsoft Systems Journal may be preceded by the control symbol / *. This control symbol identifies destinations whose related text should be ignored if the RTF reader does not recognize the destination. (RTF writers SHOULD FOLLOW THE CONVENDING THIS Control Symbol by Used Destinations or Groups.) Destinations Whose Related Text Should Be INSE rted into the document, even if the RTF reader does not recognize the destination, should not use / *. All destinations that were not included in the March 1987 revision of the RTF Specification are shown with / * as part of the control word.

The format specified by the group only affects the text in the group. In general, the format of the text in a group can inherit the text from it before it. However, the Microsoft of RTF is implemented, but the footnote, annotation, header and footer (will be narrative in this chapter) not inherit its previous text format. Therefore, in order to ensure that these groups are always properly formatted, you should use / sectd, / pard, / play control words to set formatting in these groups by default, then add any of your desired formatted content. Formatting specified within a group affects only the text within that group. Generally, text within a group inherits the formatting of the text in the preceding group. However, Microsoft implementations of RTF assume that the footnote, annotation, header, and footer groups (described later in this chapter) do not inherit the formatting of the preceding text. Therefore, to ensure that these groups are always formatted correctly, you should set the formatting within these groups to the default with the / sectd, / pard, and / plain control Words, and then add anyy desired formatting. Control word, control symbol, and brace control information. All other characters in the file are plain text. There is a text example in the group can not be present:. The control words, control symbols, and braces constitute control information All other characters in the file are plain text Here is an example of plain text that does not exist within a group. :

{/ RTF / ANSI / DEFF0 {/ FONTTBL {/ F0 / Froman TMS RMN;}}}} {/ f2 / fswiss helv;}} {/ colortbl; / red0 / green0 / blue0; / red0 / green0 / blue255; / red0 / green255 / blue255; / red0 / green255 / blue0; / red255 / green0 / blue255; / red255 / green0 / blue0; / red255 / green255 / blue0; / red255 / green255 / blue255;} {/ stylesheet {/ fs20 / snext0normal;}} {/ info {/ author john doe} {/ creatim / yr1990 / mo7 / dy30 / hr10 / min48} {/ version1} {/ edmins0} {/ nofpages1} {/ NOFWORDS0}}} {/ NOFWORDS0}}} {/ NOFWORDS0} } {/ VERN8351}} / widoctrl / ftnbj / seatd / linex0 / endnhere / pard / plain / fs20 this is put text./par}

The phrase "this is plain text" is not part of a group, but treated as a document text. .

As mentioned earlier, there is a special meaning in the RTF backslash (/) and braces ({}), so when using these characters as text, you need to add a backslash before they, like this / /, / {, /}. AS Previously Mentioned, THE BACKSLASH (/) AND BRACES ({}) Have Special Meaning In RTF. To Use these character with a backslash, as in //, / {, and / }.rtf file content

A RTF file meets the following syntax: an RTF file Has The Following Syntax: '{'

'}' This syntax is the standard RTF syntax, and any RTF viewer should be able to explain the correct explanation The RTF file written in the grammatical format. It is necessary to reiterate that the RTF viewer does not have to contain all the control words, but it must be ignored to ignore the control word it does not know (or unused), and must be able to pass the control word symbol / Control * The portion of the mark is marked. However, the editor that generates RTF may not fully comply with this grammar specification. Similarly, the RTF viewer should have enough capabilities to deal with some minor change control words. Nonetheless, if a built-in editor is in line with this specification, then any correct RTF viewer should be perfectly explained. This syntax is the standard RTF syntax; any RTF reader must be able to correctly interpret RTF written to this syntax It is worth mentioning again that RTF readers do not have to use all control words, but they must be able to harmlessly ignore unknown (. or unused) control words, and they must correctly skip over destinations marked with the / control * symbol. There may, however, be RTF writers that generate RTF that does not conform to this syntax, and as such, RTF readers should be robust enough To Handle Some Minor Variations. Nonetheless, IF An RTF Writer Generates RTF Conforming To this Specification, The Any Correct RTF Reader Should Be Aable To Interpret IT.

转载请注明原文地址:https://www.9cbs.com/read-105126.html

New Post(0)