Paragraphs

The most basic unit of block-level content within a WordprocessingML document, paragraphs are stored using the <p> element. A paragraph defines a distinct division of content that begins on a new line. A paragraph can contain three pieces of information: optional paragraph properties, inline content (typically runs), and a set of optional revision IDs used to compare the content of two documents.

Consider the paragraph fragment "The quick brown fox jumped …" which is centered on a paragraph. As all the text in the paragraph is emphasized using italics, in the XML, the contents of the paragraph will have the justify-center property, and each run within the paragraph (as well as the run properties for the paragraph mark) stores the italics property; for example:

<w:p>
  <w:pPr>
    <w:jc w:val="center"/>
    <w:rPr>
      <w:i/>
    </w:rPr>
  </w:pPr>
  <w:r>
    <w:rPr>
      <w:i/>
    </w:rPr>
    <w:t>The quick brown fox jumped…</w:t>
  </w:r>
</w:p>

Notice that each run specifies the character formatting information for its contents, and the paragraph specifies the paragraph level formatting (the center-justification). It is also notable that since leading and trailing whitespace is not normally significant in XML, some runs require a designating specifying that their whitespace is significant via the <xml:space> element.

A paragraph's properties are specified via the <pPr >element. Some examples of paragraph properties are alignment, border, hyphenation override, indentation, line spacing, shading, text direction, and widow/orphan control.

It should also be noted that a <pPr >element may contain a set of run properties within a <rPr >element – these properties are applied to the run which contains the glyph which represents the paragraph mark and not the entire paragraph.