w:u (Underline)
Applies underline formatting to the run, with a w:val attribute specifying the underline style.
Parent elements
Description
w:u applies underline formatting to the run. It is defined in ECMA-376 Part 1 §17.3.2.40.
The w:val attribute selects the underline style; the optional w:color attribute sets the underline colour independently of the text colour. When w:val="none" the underline is explicitly removed (used to cancel underline inherited from a style).
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_Underline |
single, double, thick, dotted, dottedHeavy, dash, dashedHeavy, dashLong, dashLongHeavy, dotDash, dotDashHeavy, dotDotDash, dotDotDashHeavy, wave, wavyHeavy, wavyDouble, words, none |
Underline style. words underlines only non-whitespace characters. none removes underline. |
w:color |
ST_HexColorAuto |
6-digit hex RGB (e.g. FF0000) or auto |
Colour of the underline. Defaults to the run text colour when omitted. |
Examples
<!-- Single solid underline -->
<w:rPr>
<w:u w:val="single"/>
</w:rPr>
new RunProperties(
new Underline { Val = UnderlineValues.Single });
<!-- Red wavy underline: spell-check or grammar indicator -->
<w:rPr>
<w:u w:val="wave" w:color="FF0000"/>
</w:rPr>
new RunProperties(
new Underline { Val = UnderlineValues.Wave, Color = "FF0000" });
<!-- Double underline: emphasis -->
<w:rPr>
<w:u w:val="double" w:color="0000FF"/>
</w:rPr>
new RunProperties(
new Underline { Val = UnderlineValues.Double, Color = "0000FF" });
Underline Styles
| Style | Appearance | Use Case |
|---|---|---|
single |
Single solid line | Standard underline |
double |
Two parallel lines | Emphasis, titles |
thick |
Thick solid line | Strong emphasis |
dotted |
Dots | Emphasis |
dash |
Dashes | Emphasis |
dashLong |
Long dashes | Emphasis |
dotDash |
Dot-dash pattern | Emphasis |
dotDotDash |
Dot-dot-dash pattern | Emphasis |
wave |
Wavy line | Spell-check indicator |
wavyDouble |
Double wavy line | Emphasis |
words |
Underline non-whitespace only | Technical formatting |
none |
No underline | Toggle cancellation |
Underline Usage Patterns
When to Use Each Style
| Style | Typical Use | Example |
|---|---|---|
single |
Standard emphasis, hyperlinks | Underlined text, Click here |
double |
Strong emphasis, important text | Very important notice |
thick |
Maximum emphasis, warnings | WARNING: Read carefully |
dotted |
Subtle emphasis, edits | Suggested change |
dash |
Emphasis, strikethrough alternative | Emphasis without full strike |
wave |
Spell-check indicator | misspelled words |
words |
Emphasize content only | Skip spaces and punctuation |
Spell-Check Convention
<!-- Red wavy underline: common spell-check visual -->
<w:rPr>
<w:u w:val="wave" w:color="FF0000"/>
</w:rPr>
This is conventionally interpreted by humans as a spelling error even without additional UI cues.
Hyperlink Styling
<!-- Standard hyperlink format: blue underline -->
<w:hyperlink w:anchor="_top">
<w:r>
<w:rPr>
<w:rStyle w:val="Hyperlink"/>
<w:u w:val="single"/>
<w:color w:val="0563C1"/>
</w:rPr>
<w:t>Click here</w:t>
</w:r>
</w:hyperlink>
Words-Only Underline
<!-- Underline only non-whitespace characters -->
<w:rPr>
<w:u w:val="words"/>
</w:rPr>
Result: “This text” renders as This text (spaces not underlined)
Useful for:
- Form fill-in blanks: “Name: _____”
- Signature lines: “Approved by: _____”
- Technical documentation: Skip underlines on punctuation
Underline Color Strategies
Match Text Color (Default)
<w:rPr>
<w:u w:val="single"/> <!-- Color defaults to text color -->
</w:rPr>
Independent Underline Color
<w:rPr>
<w:color w:val="000000"/> <!-- Black text -->
<w:u w:val="single" w:color="FF0000"/> <!-- Red underline -->
</w:rPr>
Transparent/Invisible Underline
<w:rPr>
<w:u w:val="single" w:color="FFFFFF"/> <!-- White underline (invisible on white background) -->
</w:rPr>
Useful for preserving formatting structure without visual impact.
Form Design Example
<!-- Label + fill-in line -->
<w:r><w:t>Name: </w:t></w:r>
<w:r>
<w:rPr>
<w:u w:val="words"/>
</w:rPr>
<w:t>____________________________</w:t>
</w:r>
Notes
- Underline Style:
w:valcontrols line pattern (single, double, dotted, wavy, etc.). - Underline Color:
w:coloris independent of text color; defaults to text color when omitted. - Toggle Property:
w:u w:val="none"cancels underline inherited from style. - Words Only:
w:val="words"underlines letters and digits but skips spaces. - Color Format: 6-digit hex RGB (e.g.,
FF0000for red). - Spell-Check Style: Wavy underlines (
wave,wavyHeavy,wavyDouble) conventionally indicate spelling/grammar. - Hyperlinks: Hyperlinks are typically underlined and colored; adjust these independently if needed.
- Complex Script: Use
w:uCsfor Arabic, Hebrew, and complex scripts paired withw:u. - Print Display: Underline patterns render as designed in print; some may simplify to single line on legacy printers.
- Accessibility: Underlines can indicate emphasis or errors; combine with color or text changes for clarity.
- Form Design: Use
wordsunderline for signature/fill-in lines in forms. - Compatibility: Standard underlines (single, double) are supported everywhere; fancy styles may vary by Office version.
- Overuse: Avoid excessive underlines; prefer other emphasis methods (bold, color, style).