@@ -221,9 +221,12 @@ the one above::
221221 p = document.add_paragraph('Lorem ipsum dolor sit amet.')
222222 p.style = 'ListBullet'
223223
224- Again, the style name is formed by removing the spaces in the name as it
225- appears in the Word UI. So the style 'List Number 3' would be specified as
226- ``'ListNumber3' ``.
224+ The style is specified using its style ID, 'ListBullet' in this example.
225+ Generally, the style ID is formed by removing the spaces in the style name as
226+ it appears in the Word user interface (UI). So the style 'List Number 3'
227+ would be specified as ``'ListNumber3' ``. However, note that if you are using
228+ a localized version of Word, the style ID may be derived from the English
229+ style name and may not correspond so neatly to its style name in the Word UI.
227230
228231
229232Applying bold and italic
@@ -285,3 +288,32 @@ make your code simpler if you're building the paragraph up from runs anyway::
285288 p.add_run('Lorem ipsum ')
286289 p.add_run('dolor').bold = True
287290 p.add_run(' sit amet.')
291+
292+
293+ Applying a character style
294+ --------------------------
295+
296+ In addition to paragraph styles, which specify a group of paragraph-level
297+ settings, Word has *character styles * which specify a group of run-level
298+ settings. In general you can think of a character style as specifying a font,
299+ including its typeface, size, color, bold, italic, etc.
300+
301+ Like paragraph styles, a character style must already be defined in the document you open with the ``Document() `` call (*see * :doc: `styles `).
302+
303+ A character style can be specified when adding a new run::
304+
305+ p = document.add_paragraph('Normal text, ')
306+ p.add_run('text with emphasis.', 'Emphasis')
307+
308+ You can also apply a style to a run after it is created. This code produces
309+ the same result as the lines above::
310+
311+ p = document.add_paragraph('Normal text, ')
312+ r = p.add_run('text with emphasis.')
313+ r.style = 'Emphasis'
314+
315+ As with a paragraph style, the style ID is formed by removing the spaces in
316+ the name as it appears in the Word UI. So the style 'Subtle Emphasis' would
317+ be specified as ``'SubtleEmphasis' ``. Note that if you are using
318+ a localized version of Word, the style ID may be derived from the English
319+ style name and may not correspond to its style name in the Word UI.
0 commit comments