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.
The control word is a special RTF to mark the formatted command for the printer control, and is also a formatted information to manage 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. The phrase "this is put text" is not part of a group and is what is what is document.