w:unhideWhenUsed (Unhide Style When Applied)
Instructs an authoring application to remove the semiHidden flag from a style the first time the style is applied to content.
Parent elements
Description
w:unhideWhenUsed is a toggle element that, when set on a style, causes the authoring application to automatically remove w:semiHidden the first time the style is applied. After that initial use, the style becomes fully visible in the UI.
It is defined in ECMA-376 Part 1 §17.7.4.19.
w:unhideWhenUsed is almost always paired with w:semiHidden. Together they implement the “hidden unless used” behavior for Word’s internal styles like Default Paragraph Font.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_OnOff |
true, false, 1, 0, on, off |
Enables or disables the unhide-on-use behavior. Omitting w:val is equivalent to true. |
Examples
<w:style w:type="character" w:styleId="DefaultParagraphFont">
<w:name w:val="Default Paragraph Font"/>
<w:uiPriority w:val="1"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
</w:style>
using DocumentFormat.OpenXml.Wordprocessing;
var style = new Style(
new StyleName { Val = "Default Paragraph Font" },
new UIPriority { Val = 1 },
new SemiHidden(),
new UnhideWhenUsed()
)
{
Type = StyleValues.Character,
StyleId = "DefaultParagraphFont"
};
Notes
- When the user applies the style for the first time, the authoring application should update the
w:styleelement instyles.xmlby removingw:semiHidden. - If
w:unhideWhenUsedis present butw:semiHiddenis not, it has no practical effect.