OfficeOpenXML.com
 

Wordprocessing Paragraphs

Properties

Paragraph properties are specified in <pPr>. Each property is a child element of <pPr>. When appearing within a paragraph (w:p) element rather than within a style element (w:style), they are direct formatting and are applied after style/numbering/table properties. Compare with paragraph styles.

<w:pPr>
<w:pBdr>
<w:bottom w:val="single" w:sz="8" w:space="4" w:color="4F81BD"/>
</w:pBdr>
<w:spacing w:after="300"/>
</w:pPr>
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.26.

The most commonly used properties are shown below:

Elements/Properties:

ElementDescription
framePr Defines the paragraph as a text frame, which is a free-standing paragraph similar to a text box . See Text Frames.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.11.
ind Defines the indentation for the paragraph. See Paragraphs - Indentation.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.12.
jc Specifies the paragraph alignment. See Paragraphs - Alignment.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.13.
keepLines Specifies that all lines of the paragraph are to be kept on a single page when possible. It is an empty element: <w:keeplines/>.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.14.
keepNext Specifies that the paragraph (or at least part of it) should be rendered on the same page as the next paragraph when possible. It is an empty element: <w:keepNext/>. If multiple paragraphs are to be kept together but they exceed a page, then the set of paragraphs begin on a new page and page breaks are used thereafter as needed.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.15.
numPr

Specifies that the paragraph should be numbered and inherits the properties specified by the numbering definition in the num element within the numbering part. The particular numbering definition is specified with the numId child of numPr, and the particular level within the numbering definition is specified by the ilvl child of numPr.

<w:pPr>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="1"/>
</w:numPr>
</w:pPr>

numPr has the following child elements.

ElementDescription
numId Specifies a reference to a numbering definition instance (corresponding to <w:num w:numId="1"/>). The instance will appear in the numbering part and itself references the <w:abstractNum> element which defines the numbering. numId has a single attribute val. The val attribute will not have a value of 0 except to remove numbering properties at a particular level in the style hierarchy (as with direct formatting).
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.9.19.
ilvl

Specifies the numbering level of the numbering definition to use for the paragraph. It corresponds to the <w:lvl w:ilvl="0"> element within <w:abstractNum> element of the numbering part.

Note: When numbering is done with direct formatting (i.e., the pPr is not within a style), then both the numbering definition instance and level within the instance are specified by including both a numId and an ilvl. When numbering is done as part of a style, only the numId is specified. The level of the numbering definition to be applied is indicated in the numbering definition with a reference to the paragraph style. See the example below.

<w:abstractNum w:abstractNumId="1">
. . .
<w:lvl w:ilvl="0">
. . .
<w:pStyle w:val="TestParagraphStyle"/>
<w:pPr>
. . .
</w:pPr>
. . .
</w:lvl>
</w:abstractNum>
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.9.3.

See Numbering, Levels & Lists - Overview for greater discussion of numbering.

Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.19.
outlineLvl Specifies the outline level associated with the paragraph. It is used to build the table of contents and does not affect the appearance of the text. The single attribute val can have a value of from 0 to 9, where 9 indicates that no outline level applies to the paragraph. So <w:outlineLvl w:val="0"/> indicates that the paragraph is an outline level 1.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.20.
pBdr Specifies borders for the paragraph. See Paragraphs - Borders.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.24.
pStyle Specifies the style ID of a paragraph style. See Defining a Style - Paragraph Styles.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.27.
rPr Specifies the run properties for the paragraph glyph, which is used to represent the physical location of the paragraph mark. When the mark is formatted, a rPr appears within pPr. The text is then formatted accordingly, except for possible direct text formatting. See Text - Formatting.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.29.
sectPr Specifies the properties for a section. For all sections except the last section, the sectPr element is stored as a child element of the last paragraph in the section. For the last section, the sectPr is stored as a child element of the body element. See Sections.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.6.18.
shd Specifies shading for the paragraph. See Paragraphs - Shading.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.31.
spacing Specifies between paragraphs and between lines of a paragaph. See Paragraphs - Spacing.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.33.
tabs Specifies custom tabs. See Paragraphs - Tabs.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.38.
textAlignment Specifies the alignment of characters on each line when characters are of varying size. See Paragraphs - Vertical Text Alignment.
Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.39.