w:pBdr (Paragraph Borders)
Defines border lines on the top, bottom, left, and right edges of a paragraph.
Parent elements
Description
w:pBdr defines paragraph borders — visible lines drawn around or between paragraphs. It is defined in ECMA-376 Part 1 §17.3.1.24.
w:pBdr is a child of w:pPr and contains optional w:top, w:left, w:bottom, w:right, w:between (line between adjacent bordered paragraphs), and w:bar (vertical bar on the left/right margin) children. Each border child shares the same attributes.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | Border sides are specified via w:top, w:left, w:bottom, w:right, w:between, and w:bar child elements. |
Each border child element (e.g. w:top) uses the following attributes:
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_Border |
single, double, thick, dotted, dashed, dotDash, dashDot, dashDotDot, triple, thinThickSmallGap, wave, none, nil, and many more. |
Border style. |
w:sz |
xsd:unsignedLong |
Border width in eighths of a point (e.g. 4 = 0.5 pt, 8 = 1 pt). |
Border thickness. |
w:space |
xsd:unsignedLong |
Distance from text in points. | Space between the text and the border line. |
w:color |
ST_HexColorRGB or auto |
Six-digit hex RGB (e.g. FF0000) or auto. |
Border colour. |
Examples
<!-- Box border around paragraph -->
<w:pBdr>
<w:top w:val="single" w:sz="4" w:space="1" w:color="000000"/>
<w:left w:val="single" w:sz="4" w:space="4" w:color="000000"/>
<w:bottom w:val="single" w:sz="4" w:space="1" w:color="000000"/>
<w:right w:val="single" w:sz="4" w:space="4" w:color="000000"/>
</w:pBdr>
new ParagraphBorders(
new TopBorder { Val = BorderValues.Single, Size = 4, Space = 1, Color = "000000" },
new LeftBorder { Val = BorderValues.Single, Size = 4, Space = 4, Color = "000000" },
new BottomBorder { Val = BorderValues.Single, Size = 4, Space = 1, Color = "000000" },
new RightBorder { Val = BorderValues.Single, Size = 4, Space = 4, Color = "000000" });