Styles collection ================= Candidate protocols ------------------- Access:: >>> styles = document.styles # default styles part added if not present >>> styles Iteration and length:: >>> len(styles) 10 >>> list_styles = [s for s in styles if s.type == WD_STYLE_TYPE.LIST] >>> len(list_styles) 3 Access style by name (or style id):: >>> styles['Normal'] >>> styles['undefined-style'] KeyError: no style with id or name 'undefined-style' :meth:`.Styles.add_style()`:: >>> style = styles.add_style('Citation', WD_STYLE_TYPE.PARAGRAPH) >>> style.name 'Citation' >>> style.type PARAGRAPH (1) >>> style.builtin False Feature Notes ------------- * could add a default builtin style from known specs on first access via WD_BUILTIN_STYLE enumeration:: >>> style = document.styles['Heading1'] KeyError: no style with id or name 'Heading1' >>> style = document.styles[WD_STYLE.HEADING_1] >>> assert style == document.styles['Heading1'] Example XML ----------- .. highlight:: xml :: Schema excerpt -------------- ::