w:vanish (Hidden Text)
Marks the run as hidden so its content is not displayed or printed (unless Show Hidden Text is enabled).
Parent elements
Description
w:vanish hides the run so that its text is not displayed or printed. It is an on/off toggle property defined in ECMA-376 Part 1 §17.3.2.41.
Hidden text is still present in the document XML and can be revealed by enabling “Show hidden text” in the application. Field instruction runs (between w:fldChar begin and w:fldChar separate) commonly use w:vanish to suppress display of the raw field code in normal view.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_OnOff |
true, 1, on (hidden) / false, 0, off (visible). Omitting the attribute is equivalent to true. |
Toggles hidden text on or off. |
Examples
<w:r>
<w:rPr>
<w:vanish/>
</w:rPr>
<w:t>This text is hidden</w:t>
</w:r>
new Run(
new RunProperties(new Vanish()),
new Text("This text is hidden"));
Notes
- Hidden text still occupies space in the XML and affects word count unless explicitly excluded.
- Setting
w:vanishdoes not prevent the text from being copied, searched, or accessed programmatically.