w:b (Bold)
Applies bold formatting to the text of the run.
Parent elements
Description
w:b applies bold formatting to all text in the run. It is an on/off toggle property defined in ECMA-376 Part 1 §17.3.2.1.
When w:b is present with no w:val attribute, or with w:val="true", bold is active. Setting w:val="false" explicitly turns bold off — this is used in child styles to cancel bold inherited from a parent style (the toggle pattern).
The complex-script equivalent is w:bCs.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_OnOff |
true, 1, on (bold on) / false, 0, off (bold off). Omitting the attribute is equivalent to true. |
Toggles bold on or off. |
Examples
Bold run
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>Bold text</w:t>
</w:r>
new Run(
new RunProperties(new Bold()),
new Text("Bold text"));
Cancelling inherited bold in a child style
<w:rPr>
<w:b w:val="false"/>
</w:rPr>
new RunProperties(
new Bold { Val = false });
Notes
w:bis a toggle property. If a parent style enables bold and a child style contains<w:b w:val="false"/>, the bold is cancelled for that child.- The complex-script counterpart
w:bCscontrols bold for right-to-left and complex script text segments within the same run.