w:bdr (Text Border)

Draws a border around the individual characters of a run.

Parent elements

Description

w:bdr applies a border around the text characters in a run. Unlike w:pBdr (which borders an entire paragraph), w:bdr borders are drawn tightly around each contiguous run that carries the same w:bdr style — adjacent runs with identical border settings are grouped under one continuous border box.

It is defined in ECMA-376 Part 1 §17.3.2.5.

The attribute set mirrors that of paragraph borders (w:pBdr children) and table cell borders.

Attributes

Attribute Type Possible Values Description
w:val ST_Border single, double, dashSmallGap, dotDash, none, and many others Border line style.
w:color ST_HexColor Six-digit hex RGB (e.g. FF0000) or auto Border color.
w:sz xsd:integer Width in eighths of a point (e.g. 4 = ½ pt) Border line width.
w:space xsd:integer Spacing in points between border and text Space between the border and the text characters.
w:themeColor ST_ThemeColor dark1, light1, accent1, etc. Theme color reference.
w:themeTint ST_UcharHexNumber Two-digit hex (00–FF) Tint applied to the theme color.
w:themeShade ST_UcharHexNumber Two-digit hex (00–FF) Shade applied to the theme color.
w:shadow ST_OnOff true, false Add a shadow effect to the border.
w:frame ST_OnOff true, false Draw as a frame (border appears as a 3D frame).

Examples

<!-- Single thin black border around the run -->
<w:r>
  <w:rPr>
    <w:bdr w:val="single" w:color="000000" w:sz="4" w:space="1"/>
  </w:rPr>
  <w:t>Bordered text</w:t>
</w:r>

Notes

  • The w:space attribute specifies the gap between the text and the border in points.
  • Adjacent runs with identical w:bdr settings are visually merged into one continuous border box.
  • Use w:val="none" to explicitly remove an inherited border.