w:uiPriority (Style UI Priority)
Sets the sort order of a style in the authoring application's Quick Styles gallery and Styles pane.
Parent elements
Description
w:uiPriority assigns a numeric priority to a style for display in the UI. Styles with lower values appear earlier in the Styles pane and Quick Styles gallery. Styles with the same priority value are sorted alphabetically within that priority group.
It is defined in ECMA-376 Part 1 §17.7.4.18.
The value is an integer in the range 0–99; 0 is highest priority (shown first), 99 is lowest.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
xsd:integer |
0–99 | Sort priority: lower value = displayed earlier. |
Examples
<!-- Heading 1 shown at priority 9 -->
<w:style w:type="paragraph" w:styleId="Heading1">
<w:name w:val="heading 1"/>
<w:uiPriority w:val="9"/>
<w:qFormat/>
<!-- rPr and pPr omitted -->
</w:style>
using DocumentFormat.OpenXml.Wordprocessing;
var style = new Style(
new StyleName { Val = "heading 1" },
new UIPriority { Val = 9 },
new PrimaryStyle()
)
{
Type = StyleValues.Paragraph,
StyleId = "Heading1"
};
Notes
- The built-in Word heading styles use priorities 1–9.
- Body Text style typically uses priority 11.
- A style without
w:uiPriorityuses the default order (after all prioritized styles).