w:qFormat (Primary Style)
Marks a style as a primary (Quick) style, causing it to appear in the authoring application's Quick Styles gallery.
Parent elements
Description
w:qFormat is a toggle element that flags a style for inclusion in the Quick Styles gallery — the prominent style picker shown in Word’s ribbon Home tab. Only styles with w:qFormat set to true appear there by default.
It is defined in ECMA-376 Part 1 §17.7.4.14.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_OnOff |
true, false, 1, 0, on, off |
Enables or disables Quick Styles gallery inclusion. Omitting w:val is equivalent to true. |
Examples
<w:style w:type="paragraph" w:styleId="Heading2">
<w:name w:val="heading 2"/>
<w:basedOn w:val="Heading1"/>
<w:uiPriority w:val="9"/>
<w:qFormat/>
<!-- pPr and rPr omitted -->
</w:style>
using DocumentFormat.OpenXml.Wordprocessing;
var style = new Style(
new StyleName { Val = "heading 2" },
new BasedOn { Val = "Heading1" },
new UIPriority { Val = 9 },
new PrimaryStyle() // PrimaryStyle = w:qFormat
)
{
Type = StyleValues.Paragraph,
StyleId = "Heading2"
};
Notes
- In the Open XML SDK,
w:qFormatmaps to thePrimaryStyleclass. w:qFormatonly controls gallery visibility; the style can still be applied programmatically or through the full Styles pane regardless of this setting.