Rich-Text Format Specification V. 2 Introduction 2 rtf syntax 2 Conventions of an rtf reader 4



Download 1.09 Mb.
Page6/15
Date conversion29.04.2016
Size1.09 Mb.
1   2   3   4   5   6   7   8   9   ...   15

Paragraph Text


There are two kinds of paragraphs: plain paragraphs and table paragraphs. A table is a collection of paragraphs and a table row is a continuous sequence of paragraphs partitioned into cells. The \ intbl paragraph-formatting control word identifies the paragraph as part of a table. For more information, see "Table Definitions". This control is inherited between paragraphs which do not have paragraph properties reset with a \ pard.




|


? ?


* * ? ? (\subdocument | +) ( \ par
)?



+ \ row



+ \ cell



Paragraph-Formatting Properties


These control words (described as
in the syntax description) specify generic paragraph formatting properties. These control words can appear anywhere in the body of the paragraph, not just at the beginning.

Note that if the \pard control word is not present, the current paragraph inherits all paragraph properties defined in the previous paragraph.



The paragraph formatting control words are listed in the following table:

Control word

Meaning

\ pard

Resets to default paragraph properties.

\ sN

Designates paragraph style; if a paragraph style is specified, style properties must be specified with the paragraph.

\ hyphpar

Toggles automatic hyphenation for the paragraph. Append with 1 or leave keyword by itself to toggle property on; append 0 (zero) to turn it off.

\ intbl

Paragraph is part of a table.

\ keep

Keep paragraph intact.

\ nowidctlpar

No widow/orphan control. This is a paragraph-level property and is used to override the document-level \ widowctrl.

\ keepn

Keep paragraph with the next paragraph.

\ levelN

N is the outline level of the paragraph.

\ noline

No line numbering.

\ pagebb

Break page before the paragraph.

\ sbys

Side-by-side paragraphs.

Alignment




\ ql

Left-aligned (default).

\qr

Right-aligned.

\ qj

Justified.

\ qc

Centered.

Indentation




\ fiN

First-line indent (default is 0).

\ liN

Left indent (default is 0).

\ riN

Right indent (default is 0).

Spacing




\ sbN

Space before (default is 0).

\ saN

Space after (default is 0).

\ slN

Space between lines: if this control word is missing or if \ s1000 is used, the line spacing is automatically determined by the tallest character in the line; if n is a positive value, uses this size only if it is taller than the tallest character (otherwise uses the tallest character); if n is a negative value, uses the absolute value of n, even if it is shorter than the tallest character.

\ slmultN

Line spacing multiple; indicates that the current line spacing is a multiple of "Single" line spacing. This keyword can only follow the \ sl keyword and works in conjunction with it.

0 "At Least" or "Exactly" line spacing.



1 Multiple line spacing, relative to "Single".

Subdocuments




\ subdocumentN

This indicates that a subdocument in a Master Document/Subdocument relationship should occur here. N represents an index into the file table. This control word must be the only item in a paragraph.

Bidirectional controls




\ rtlpar

Text in this paragraph will be displayed with right to left precedence.

\ ltrpar

Text in this paragraph will be displayed with left to right precedence. This is the default.



Tabs


Any paragraph may have its own set of tabs. Tabs must follow this syntax:



( | ) +



? ? \ tx



? \ tb



\ tqr | \ tqc | \ tqdec



\ tldot | \ tlhyph | \ tlul | \ tleq




Control word

Meaning

\ txN

Tab position in twips from the left margin.

\ tqr

Flush-right tab.

\ tqc

Centered tab.

\ tqdec

Decimal tab.

\ tbN

Bar tab position in twips from the left margin.

\ tldot

Leader dots.

\ tlhyph

Leader hyphens.

\ tlul

Leader underline.

\ tlth

Leader thick line.

\ tleq

Leader equal sign.



Bullets and Numbering


To provide compatibility with existing RTF readers, all applications with the ability to automatically bullet or number paragraphs will also emit the generated text as plain text in the \ pntext group. This will allow existing RTF readers to capture the plain text, and safely ignore the autonumber instructions. This group precedes all bulleted or numbered paragraphs, and will contain all the text and formatting that would be auto-generated. It should precede the {\ *\ pn _ } destination, and it is the responsibility of RTF readers that understand the {\ *\ pn _ } destination to ignore the \ pntext group.



|





{\*' \pnseclvl
'}'









'{' \pntext '}'




\*' \pn

'}'





\pnlvl | \pnlvlblt | \pnlvlbody | \pnlvlcont



&
&


&
&





\pncard | \pndec | \pnucltr | \pnucrm | \pnlcltr | \pnlcrm | \pnord | \pnordt




\pnf? & \pnfs? & \pnb? & \pni? & \pncaps? & \pnscaps? &
? & \pnstrike? & \pncf?




\pnul | \pnuld | \pnuldb | \pnulnone | \pnulw




\pnnumonce? & \pnacross? & \pnindent? & \pnsp? & \pnprev? &
? & \pnstart? & \pnhang? & \pnrestart?




\pnqc | \pnql | \pnqr




'{' \pntxtb #PCDATA'}'




'{' \pntxta #PCDATA'}'

Settings marked with an asterisk can be turned off by appending 0 (zero) to the control word.



Control word

Definition

\ pntext

This group precedes all numbered/bulleted paragraphs, and contains all auto-generated text and formatting. It should precede the {\ *\ pn _ } destination, and it is the responsibility of RTF readers that understand the {\ *\ pn _ } destination to ignore this preceding group. This is a destination control word.

\ pn

Turns on paragraph numbering. This is a destination control word.

\ pnlvlN

Paragraph level, where N is a level from 1 to 9. Default set by \pnseclvlN section-formatting property.

\ pnlvlblt

Bulleted paragraph (corresponds to level 11). The actual character used for the bullet is stored in the \ pntxtb group.

\ pnlvlbody

Simple paragraph numbering (corresponds to level 10).

\ pnlvlcont

Continue numbering, but do not display number (“skip numbering”).

\ pnnumonce

Number each cell only once in a table (default is to number each paragraph in a table).

\ pnacross

Number across rows (Default is to number down columns).

\ pnhang

Paragraph uses a hanging indent.

\ pnrestart

Restart numbering after each section break. Note that this keyword is only used in conjunction with Heading Numbering (applying multilevel numbering to Heading style definitions).

\ pncard

Cardinal numbering (One, Two, Three).

\ pndec

Decimal numbering (1, 2, 3).

\ pnucltr

Uppercase alphabetic numbering (A, B, C).

\ pnucrm

Uppercase roman numbering (I, II, III).

\ pnlcltr

Lowercase alphabetic numbering (a, b, c).

\ pnlcrm

Lowercase roman numbering. (i, ii, iii).

\ pnord

Ordinal numbering (1st, 2nd, 3rd).

\ pnordt

Ordinal text numbering (First, Second, Third).

\ pnb

Bold numbering.*

\ pni

Italic numbering.*

\ pncaps

All Caps numbering.*

\ pnscaps

Small Caps numbering.*

\ pnul

Continuous underline.*

\ pnuld

Dotted underline.

\ pnuldb

Double underline.

\ pnulnone

Turns off underlining.

\ pnulw

Word underline.

\ pnstrike

Strikethrough numbering.*

\ pncfN

Foreground color - index into color table. Default is zero.

\ pnfN

Font number.

\ pnfsN

Font size (in half-points).

\ pnindentN

Minimum distance from margin to body text.

\ pnspN

Distance from number text to body text.

\ pnprev

Used for multilevel lists. Include information from previous level in this level; for example, 1, 1.1, 1.1.1, 1.1.1.1

\ pnqc

Centered numbering.

\ pnql

Left justified numbering.

\ pnqr

Right justified numbering.

\ pnstartN

Start At number.

\ pntxta

Text after. This group contains the text that succeeds the number. This is a destination control word.

\ pntxtb

Text before. This group contains the text that precedes the number. This is a destination control word.

Note that there is a limit of 32 characters total for the sum of text before and text after for simple numbering. Mulilevel numbering has a limit of 64 characters total for the sum of all levels.


Paragraph Borders


Paragraph borders have the following syntax:



( )+



\ brdrt | \ brdrb | \ brdrl | \ brdrr | \ brdrbtw | \ brdrbar | \ box



\ brdrw? \ brsp? \ brdrcf?



\ brdrs | \ brdrth | \ brdrsh | \ brdrdb | \ brdrdot | \brdrdash | \ brdrhair




Control word

Meaning

\ brdrt

Border top.

\ brdrb

Border bottom.

\ brdrl

Border left.

\ brdrr

Border right.

\ brdrbtw

Consecutive paragraphs with identical border formatting are considered to be part of a single group with the border information applying to the entire group. In order to have borders around individual paragraphs within the group, the \ brdrbtw control must be specified for that paragraph.

\ brdrbar

Border outside (right side of odd-numbered pages, left side of even-numbered pages).

\ box

Border around the paragraph (box paragraph).

\ brdrs

Single-thickness border.

\ brdrth

Double-thickness border.

\ brdrsh

Shadowed border.

\ brdrdb

Double border.

\ brdrdot

Dotted border.

\brdrdash

Dashed border.

\ brdrhair

Hairline border.

\ brdrwN

N is the width in twips of the pen used to draw the paragraph border line.

\ brdrcfN

N is the color of the paragraph border; specified as an index into the color table in the RTF header.

\ brspN

Space in twips between borders and the paragraph.



Paragraph Shading


Paragraph shading has the following syntax:



( \ shading |
) \ cfpat? \ cbpat?




\ bghoriz | \ bgvert | \ bgfdiag | \ bgbdiag | \ bgcross | \ bgdkhoriz | \ bgdkvert | \ bgdkfdiag | \ bgdkbdiag | \ bgdkcross | \ bgdkdcross




Control word

Meaning

\ shadingN

N is the shading of the paragraph in hundredths of a percent.

\ bghoriz

Specifies a horizontal background pattern for the paragraph.

\ bgvert

Specifies a vertical background pattern for the paragraph.

\ bgfdiag

Specifies a forward diagonal background pattern for the paragraph ( \ \ \ \ )

\ bgbdiag

Specifies a backward diagonal background pattern for the paragraph (//// ).

\ bgcross

Specifies a cross background pattern for the paragraph.

\ bgdcross

Specifies a diagonal cross background pattern for the paragraph.

\ bgdkhoriz

Specifies a dark horizontal background pattern for the paragraph.

\ bgdkvert

Specifies a dark vertical background pattern for the paragraph.

\ bgdkfdiag

Specifies a dark forward diagonal background pattern for the paragraph ( \ \ \ \ )

\ bgdkbdiag

Specifies a dark backward diagonal background pattern for the paragraph (//// ).

\ bgdkcross

Specifies a dark cross background pattern for the paragraph.

\ bgdkdcross

Specifies a dark diagonal cross background pattern for the paragraph.

\ cfpatN

N is the line color of the background pattern, specified as an index into the document's color table.

\ cbpatN

N is the background color of the background pattern, specified as an index into the document's color table.



Absolute-Positioned Objects and Frames


The following paragraph-formatting control words specify the location of a paragraph on the page. Consecutive paragraphs with the same frame formatting are considered to be part of the same frame. In order for two framed paragraphs to appear at the same position on a page, they must be separated by a paragraph with different, or no frame information.

Note that if any paragraph in a table row has any of these control words specified, then all paragraphs in the table row must have the same control words specified, either by inheriting the properties from the previous paragraph or by respecifying the controls.



Paragraph positioning has the following syntax:



& & & &



\ absw? & \ absh?



&



&



\ nowrap? & \ dxfrtext? & \ dfrmtxtx? &\ dfrmtxty?



\dropcapli? & \dropcapt?



\ phmrg? | \ phpg? | \ phcol?



\ posx? | \ posnegx? | \ posxc? | \ posxi? | \ posxo? | \ posxl? | \ posxr?



\ pvmrg? | \ pvpg? | \ pvpara?



\ posy? | \ posnegy? | \ posyt? | \ posyil? | \ posyb? | \ posyc?




Control word

Meaning

\ abswN

N is the width of the frame in twips.

\ abshN

N is the height of the frame in twips. A positive number indicates the minimum height of the frame and a negative number indicates the exact height of the frame. A value of zero indicates that the height of the frame adjusts to the contents of the frame. This is the default for frames where no height is given.

Horizontal position




\ phmrg

Use the margin as the horizontal reference frame

\ phpg

Use the page as the horizontal reference frame

\ phcol

Use the column as the horizontal reference frame. This is the default if no horizontal reference frame is given.

\ posxN

Positions the frame n twips from the left edge of the reference frame.

\ posnegxN

Same as \ posx, but allows arbitrary negative values.

\ posxc

Centers the frame horizontally within the reference frame.

\ posxi

Positions the paragraph horizontally inside the reference frame.

\ posxo

Positions the paragraph horizontally outside the reference frame.

\ posxr

Positions the paragraph to the right within the reference frame.

\ posxl

Positions the paragraph to the left within the reference frame. This is the default if no horizontal positioning information is given.

Vertical position




\ pvmrg

Positions the reference frame vertically relative to the margin. This is the default if no vertical frame positioning information is given.

\ pvpg

Positions the reference frame vertically relative to the page.

\ pvpara

Positions the reference frame vertically relative to the top of the top left corner of the next unframed paragraph in the RTF stream.

\ posyN

Positions the paragraph n twips from the top edge of the reference frame.

\ posnegyN

Same as \ posy, but allows arbitrary negative values.

\ posyil

Positions the paragraph vertically to be in-line.

\ posyt

Positions the paragraph at the top of the reference frame.

\ posyc

Centers the paragraph vertically within the reference frame.

\ posyb

Positions the paragraph at the bottom of the reference frame.

Text wrapping




\ nowrap

Prevents text from flowing around the APO.

\ dxfrtextN

Distance in twips of an absolute-positioned paragraph from text in the main text flow in all directions.

\ dfrmtxtxN

N is the horizontal distance in twips from text on both sides of the frame.

\ dfrmtxtyN

N is the vertical distance in twips from text on both sides of the frame.

Drop caps




\ dropcapliN

Number of lines drop cap is to occupy. Range is 1 through 10.

\ dropcaptN

Type of drop cap:

1 In-text drop cap.

2 Margin drop cap.

The following is an example of absolute-positioned text in a document:

\par \pard \pvpg\phpg\posxc\posyt\absw5040\dxfrtest173 First APO para

\par \pard \phmrg\posxo\posyc\dxfrtext1152 Second APO para



Table Definitions


There is no RTF table group; instead, tables are specified as paragraph properties. A table is represented as a sequence of table rows. A table row is a continuous sequence of paragraphs partitioned into cells. The table row begins with the \ trowd control word and ends with the \ row control word. Every paragraph that is contained in a table row must have the \ intbl control word specified or inherited from the previous paragraph. A cell may have more than one paragraph in it; the cell is terminated by a cell mark (the \ cell control word), and the row is terminated by a row mark (the \ row control word). Table rows can also be absolutely positioned. In this case, every paragraph in a table row must have the same positioning controls (see the controls in “Absolute-Positioned Objects and Frames”). Table properties may be inherited from the previous row; therefore, a series of table rows may be introduced by a single .

An RTF table row has the following syntax, as shown in the general paragraph-text syntax given earlier.





+ \ row



+ \ cell

A table definition has the following syntax:





\ trowd \ trgaph ? & ? & \ trleft? \trheader? & \trkeep? +



\ trql | \ trqr | \ trqc



( \ clmgf? & \ clmrg? ? & ? & ? & ? & ?) \ cellx



\ clbrdrt



\ clbrdrl



\ clbrdrb



\ clbrdrr



? \ clcfpat? & \ clcbpat? & \ clshdng



\ clbghoriz | \ clbgvert | \ clbgfdiag | \ clbgbdiag | \ clbgcross | \ clbgdkhor | \ clbgdkvert | \ clbgdkfdiag | \ clbgdkbdiag | \ clbgdkcross | \ clbgdkdcross



\ ltrrow | \ rtlrow

Note for that the number of cellxs must match the number of \cells in the \row.



The following control words further define options for each row of the table:

Control word

Meaning

\ trowd

Sets table row defaults.

\ trgaphN

Half the space between the cells of a table row in twips.

\ cellxN

Defines the right boundary of a table cell, including its half of the space between cells.

\ clmgf

The first cell in a range of table cells to be merged.

\ clmrg

Contents of the table cell are merged with those of the preceding cell.

Row formatting




\ trql

Left-justifies a table row with respect to its containing column.

\ trqr

Right-justifies a table row with respect to its containing column.

\ trqc

Centers a table row with respect to its containing column.

\ trleftN

Position of the leftmost edge of the table with respect to the left edge of its column.

\ trrhN

Height of a table row in twips; when 0, the height is sufficient for all the text in the line; when positive, the height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line.

\ trhdr

Table row header; this row should appear at the top of every page the current table appears on.

\ trkeep

Table row keep; this row cannot be split by a page break. This property is assumed off unless the keyword is present.

Bidirectional controls




\ rtlrow

Cells in this table row will have right to left precedence.

\ ltrrow

Cells in this table row will have right to left precedence. This is the default.

Row borders




\ trbrdrt

Table row border top.

\ trbrdrl

Table row border left.

\ trbrdrb

Table row border bottom.

\ trbrdrr

Table row border right.

\ trbrdrh

Table row border horizontal (inside).

\ trbrdrv

Table row border vertical (inside).

Cell borders




\ clbrdrb

Bottom table cell border.

\ clbrdrt

Top table cell border.

\ clbrdrl

Left table cell border.

\ clbrdrr

Right table cell border.

Cell shading and background pattern




\ clshdngN

N is the shading of a table cell in hundredths of a percent. This control should be included in RTF along with cell border information.

\ clbghoriz

Specifies a horizontal background pattern for the cell.

\ clbgvert

Specifies a vertical background pattern for the cell.

\ clbgfdiag

Specifies a forward diagonal background pattern for the cell ( \ \ \ \ )

\ clbgbdiag

Specifies a backward diagonal background pattern for the cell (//// ).

\ clbgcross

Specifies a cross background pattern for the cell.

\ clbgdcross

Specifies a diagonal cross background pattern for the cell.

\ clbgdkhor

Specifies a dark horizontal background pattern for the cell.

\ clbgdkvert

Specifies a dark vertical background pattern for the cell.

\ clbgdkfdiag

Specifies a dark forward diagonal background pattern for the cell ( \ \ \ \ )

\ clbgdkbdiag

Specifies a dark backward diagonal background pattern for the cell (//// ).

\ clbgdkcross

Specifies a dark cross background pattern for the cell.

\ clbgdkdcross

Specifies a dark diagonal cross background pattern for the cell.

\ clcfpatN

N is the line color of the background pattern.

\ clcbpatN

N is the background color of the background pattern.

The following is an example of table text:

\par \trowd \trqc\trgaph108\trrh280\trleft36

\clbrdrt\brdrth \clbrdrl\brdrth \clbrdrb\brdrdb

\clbrdrr\brdrdb \cellx3636\clbrdrt\brdrth

\clbrdrl\brdrdb \clbrdrb\brdrdb \clbrdrr\brdrdb

\cellx7236\clbrdrt\brdrth \clbrdrl\brdrdb

\clbrdrb\brdrdb \clbrdrr\brdrdb \cellx10836\pard \intbl

\cell \pard \intbl \cell \pard \intbl \cell \pard \intbl \row

\trowd \trqc\trgaph108\trrh280\trleft36 \clbrdrt\brdrdb

\clbrdrl\brdrth \clbrdrb \brdrsh\brdrs \clbrdrr\brdrdb

\cellx3636\clbrdrt\brdrdb \clbrdr \brdrdb

\clbrdrb\brdrsh\brdrs \clbrdrr\brdrdb

\cellx7236\clbrdrt\brdrdb \clbrdr \brdrdb

\clbrdrb\brdrsh\brdrs \clbrdrr\brdrdb \cellx10836\pard

\intbl \cell \pard \intbl \cell \pard \intbl \cell \pard

\intbl \row \pard

1   2   3   4   5   6   7   8   9   ...   15


The database is protected by copyright ©essaydocs.org 2016
send message

    Main page