@@ -3,7 +3,7 @@ Working with Styles
33===================
44
55This page uses concepts developed in the prior page without introduction. If
6- a term is unfamiliar, consult the prior page :ref: `understandingstyles ` for
6+ a term is unfamiliar, consult the prior page :ref: `understanding_styles ` for
77a definition.
88
99
@@ -242,19 +242,38 @@ There are five behavioral properties of a style:
242242* :attr: `~.Style.quick_style `
243243* :attr: `~.Style.locked `
244244
245- The key notion to understanding the behavioral properties is the *recommended
246- list *. In the style pane in Word, the user can select which list of styles
247- they want to see. One of those is named *Recommended *. All five behavior
248- properties affect some aspect of the style's appearance in this list and in
249- the style gallery.
250-
251- In brief, a style appears in the recommended list if its `hidden ` property is
252- |False |. If a style is not hidden and its `quick_style ` property is |True |,
253- it also appears in the style gallery. The style's `priority ` value (|int |)
254- determines its position in the sequence of styles. If a styles's `locked `
255- property is |True | and formatting restrictions are turned on for the
256- document, the style will not appear in any list or the style gallery and
257- cannot be applied to content.
245+ See the :ref: `style_behavior ` section in :ref: `understanding_styles ` for
246+ a description of how these behavioral properties interact to determine when
247+ and where a style appears in the Word UI.
248+
249+ The :attr: `priority ` property takes an integer value. The other four style
250+ behavior properties are *tri-state *, meaning they can take the value |True |
251+ (on), |False | (off), or |None | (inherit).
252+
253+ Display a style in the style gallery
254+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255+
256+ The following code will cause the 'Body Text' paragraph style to appear first
257+ in the style gallery::
258+
259+ >>> from docx import Document
260+ >>> document = Document()
261+ >>> style = document.styles['Body Text']
262+
263+ >>> style.hidden = False
264+ >>> style.quick_style = True
265+ >>> style.priorty = 1
266+
267+ Remove a style from the style gallery
268+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269+
270+ This code will remove the 'Normal' paragraph style from the style gallery,
271+ but allow it to remain in the recommended list::
272+
273+ >>> style = document.styles['Normal']
274+
275+ >>> style.hidden = False
276+ >>> style.quick_style = False
258277
259278
260279Working with Latent Styles
0 commit comments