w:wordWrap (Allow Line Breaking At Character Level)
Controls whether a line can break in the middle of a word when no word break point is available.
Parent elements
Description
w:wordWrap is a toggle property that controls character-level line breaking. When active, the processor is permitted to break a line mid-word if no other break opportunity exists on the line — for example, for very long URLs or unspaced CJK content.
It is defined in ECMA-376 Part 1 §17.3.1.45.
- When
true(the default): line breaks may occur between any two characters if needed. - When
false: lines may overflow the text boundary rather than break mid-word.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_OnOff |
true, false, 1, 0, on, off |
Enables character-level word wrap. Omit to inherit. |
Examples
<!-- Disable character-level word wrap -->
<w:p>
<w:pPr>
<w:wordWrap w:val="false"/>
</w:pPr>
<w:r><w:t>https://example.com/very/long/url/that/overflows</w:t></w:r>
</w:p>
using DocumentFormat.OpenXml.Wordprocessing;
var para = new Paragraph(
new ParagraphProperties(
new WordWrap { Val = false }
),
new Run(new Text("https://example.com/very/long/url/that/overflows"))
);
Notes
- Particularly relevant for East Asian (CJK) text where word boundaries differ from Western languages.
- The
w:kinsokuproperty controls separate CJK typography line-breaking rules.