1+ .. _understandingstyles :
12
23Understanding Styles
34====================
@@ -27,9 +28,9 @@ text, a table, and a list, respectively.
2728
2829Experienced programmers will recognize styles as a level of indirection. The
2930great thing about those is it allows you to define something once, then apply
30- that definition many times. This saves the work of defining the same thing over
31- an over; but more importantly it allows you to change it the definition and
32- have that change reflected in all the places you originally applied it.
31+ that definition many times. This saves the work of defining the same thing
32+ over an over; but more importantly it allows you to change the definition and
33+ have that change reflected in all the places you have applied it.
3334
3435
3536Why doesn't the style I applied show up?
@@ -49,11 +50,11 @@ work around it, so here it is up top.
4950 The file would get a little bloated if it contained all the style
5051 definitions you could use but haven't.
5152
52- #. If you apply a style that's not defined in your file (in the styles.xml part
53- if you're curious), Word just ignores it. It doesn't complain, it just
54- doesn't change how things are formatted. I'm sure there's a good reason for
55- this. But it can present as a bit of a puzzle if you don't understand how
56- Word works that way.
53+ #. If you apply a style using | docx | that's not defined in your file (in the
54+ styles.xml part if you're curious), Word just ignores it. It doesn't
55+ complain, it just doesn't change how things are formatted. I'm sure
56+ there's a good reason for this. But it can present as a bit of a puzzle if
57+ you don't understand how Word works that way.
5758
5859#. When you use a style, Word adds it to the file. Once there, it stays.
5960 I imagine there's a way to get rid of it, but you have to work at it. If
@@ -75,8 +76,74 @@ then deleting the paragraph works fine. That's how I got the ones below into
7576the default template :).
7677
7778
79+ Glossary
80+ --------
81+
82+ style definition
83+ A ``<w:style> `` element in the styles part of a document that explicitly
84+ defines the attributes of a style.
85+
86+ defined style
87+ A style that is explicitly defined in a document. Contrast with *latent
88+ style *.
89+
90+ built-in style
91+ One of the set of 276 pre-set styles built into Word, such as "Heading
92+ 1". A built-in style can be either defined or latent. A built-in style
93+ that is not yet defined is known as a *latent style *. Both defined and
94+ latent built-in styles may appear as options in Word's style panel and
95+ style gallery.
96+
97+ custom style
98+ Also known as a *user defined style *, any style defined in a Word
99+ document that is not a built-in style. Note that a custom style cannot be
100+ a latent style.
101+
102+ latent style
103+ A built-in style having no definition in a particular document is known
104+ as a *latent style * in that document. A latent style can appear as an
105+ option in the Word UI depending on the settings in the |LatentStyles |
106+ object for the document.
107+
108+ recommended style list
109+ A list of styles that appears in the styles toolbox or panel when
110+ "Recommended" is selected from the "List:" dropdown box.
111+
112+ Style Gallery
113+ The selection of example styles that appear in the ribbon of the Word UI
114+ and which may be applied by clicking on one of them.
115+
116+
117+ Identifying a style
118+ -------------------
119+
120+ A style has three identifying properties, `name `, `style_id `, and `type `.
121+
122+ Each style's :attr: `name ` property is its stable, unique identifier for
123+ access purposes.
124+
125+ A style's :attr: `style_id ` is used internally to key a content object such as
126+ a paragraph to its style. However this value is generated automatically by
127+ Word and is not guaranteed to be stable across saves. In general, the style
128+ id is formed simply by removing spaces from the *localized * style name,
129+ however there are exceptions. Users of |docx | should generally avoid using
130+ the style id unless they are confident with the internals involved.
131+
132+ A style's :attr: `type ` is set at creation time and cannot be changed.
133+
134+
135+ Style inheritance
136+ -----------------
137+
138+ A style can inherit properties from another style, somewhat similarly to how
139+ Cascading Style Sheets (CSS) works. Inheritance is specified using the
140+ :attr: `~.BaseStyle.base_style ` attribute. By basing one style on another, an
141+ inheritance hierarchy of arbitrary depth can be formed. A style having no
142+ base style inherits properties from the document defaults.
143+
144+
78145Paragraph styles in default template
79- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146+ ------------------------------------
80147
81148* Normal
82149* BodyText
@@ -114,8 +181,38 @@ Paragraph styles in default template
114181* Title
115182
116183
184+ Character styles in default template
185+ ------------------------------------
186+
187+ * BodyTextChar
188+ * BodyText2Char
189+ * BodyText3Char
190+ * BookTitle
191+ * DefaultParagraphFont
192+ * Emphasis
193+ * Heading1Char
194+ * Heading2Char
195+ * Heading3Char
196+ * Heading4Char
197+ * Heading5Char
198+ * Heading6Char
199+ * Heading7Char
200+ * Heading8Char
201+ * Heading9Char
202+ * IntenseEmphasis
203+ * IntenseQuoteChar
204+ * IntenseReference
205+ * MacroTextChar
206+ * QuoteChar
207+ * Strong
208+ * SubtitleChar
209+ * SubtleEmphasis
210+ * SubtleReference
211+ * TitleChar
212+
213+
117214Table styles in default template
118- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215+ --------------------------------
119216
120217* TableNormal
121218* ColorfulGrid
@@ -217,33 +314,3 @@ Table styles in default template
217314* MediumShading2-Accent5
218315* MediumShading2-Accent6
219316* TableGrid
220-
221-
222- Character styles in default template
223- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224-
225- * BodyText2Char
226- * BodyText3Char
227- * BodyTextChar
228- * BookTitle
229- * DefaultParagraphFont
230- * Emphasis
231- * Heading1Char
232- * Heading2Char
233- * Heading3Char
234- * Heading4Char
235- * Heading5Char
236- * Heading6Char
237- * Heading7Char
238- * Heading8Char
239- * Heading9Char
240- * IntenseEmphasis
241- * IntenseQuoteChar
242- * IntenseReference
243- * MacroTextChar
244- * QuoteChar
245- * Strong
246- * SubtitleChar
247- * SubtleEmphasis
248- * SubtleReference
249- * TitleChar
0 commit comments