Skip to content

Commit ddaa7ad

Browse files
author
Steve Canny
committed
docs: document CT_Styles analysis
1 parent 953919b commit ddaa7ad

File tree

3 files changed

+140
-1
lines changed

3 files changed

+140
-1
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#############
2+
``CT_Styles``
3+
#############
4+
5+
.. highlight:: xml
6+
7+
.. csv-table::
8+
:header-rows: 0
9+
:stub-columns: 1
10+
:widths: 15, 50
11+
12+
Schema Name, CT_Styles
13+
Spec Name, Styles
14+
Tag(s), w:styles
15+
Namespace, wordprocessingml (wml.xsd)
16+
Spec Section, 17.7.4.18
17+
18+
19+
Analysis
20+
========
21+
22+
Only styles with an explicit ``<w:style>`` definition affect the formatting
23+
of paragraphs that are assigned that style.
24+
25+
Word includes behavior definitions (``<w:lsdException>`` elements) for the
26+
"latent" styles that are built in to the Word client. These are present in a
27+
new document created from install defaults.
28+
29+
Word does not add a formatting definition (``<w:style>`` element) for a
30+
built-in style until it is used.
31+
32+
Once present in ``styles.xml``, Word does not remove a style element when it
33+
is no longer used by any paragraphs. The definition of each of the styles
34+
ever used in a document are accumulated in ``styles.xml``.
35+
36+
37+
attributes
38+
^^^^^^^^^^
39+
40+
None.
41+
42+
43+
child elements
44+
^^^^^^^^^^^^^^
45+
46+
============ ==== ================
47+
name # type
48+
============ ==== ================
49+
docDefaults ? CT_DocDefaults
50+
latentStyles ? CT_LatentStyles
51+
style \* CT_TextParagraph
52+
============ ==== ================
53+
54+
55+
Spec text
56+
^^^^^^^^^
57+
58+
This element specifies all of the style information stored in the
59+
WordprocessingML document: style definitions as well as latent style
60+
information.
61+
62+
Example: The Normal paragraph style in a word processing document can have
63+
any number of formatting properties, e.g. font face = Times New Roman; font
64+
size = 12pt; paragraph justification = left. All paragraphs which reference
65+
this paragraph style would automatically inherit these properties.
66+
67+
68+
Schema excerpt
69+
^^^^^^^^^^^^^^
70+
71+
::
72+
73+
<xsd:complexType name="CT_Styles">
74+
<xsd:sequence>
75+
<xsd:element name="docDefaults" type="CT_DocDefaults" minOccurs="0"/>
76+
<xsd:element name="latentStyles" type="CT_LatentStyles" minOccurs="0" maxOccurs="1"/>
77+
<xsd:element name="style" type="CT_Style" minOccurs="0" maxOccurs="unbounded"/>
78+
</xsd:sequence>
79+
</xsd:complexType>
80+
81+
<xsd:complexType name="CT_DocDefaults">
82+
<xsd:sequence>
83+
<xsd:element name="rPrDefault" type="CT_RPrDefault" minOccurs="0"/>
84+
<xsd:element name="pPrDefault" type="CT_PPrDefault" minOccurs="0"/>
85+
</xsd:sequence>
86+
</xsd:complexType>
87+
88+
<xsd:complexType name="CT_LatentStyles">
89+
<xsd:sequence>
90+
<xsd:element name="lsdException" type="CT_LsdException" minOccurs="0" maxOccurs="unbounded"/>
91+
</xsd:sequence>
92+
<xsd:attribute name="defLockedState" type="s:ST_OnOff"/>
93+
<xsd:attribute name="defUIPriority" type="ST_DecimalNumber"/>
94+
<xsd:attribute name="defSemiHidden" type="s:ST_OnOff"/>
95+
<xsd:attribute name="defUnhideWhenUsed" type="s:ST_OnOff"/>
96+
<xsd:attribute name="defQFormat" type="s:ST_OnOff"/>
97+
<xsd:attribute name="count" type="ST_DecimalNumber"/>
98+
</xsd:complexType>
99+
100+
<xsd:complexType name="CT_Style">
101+
<xsd:sequence>
102+
<xsd:element name="name" type="CT_String" minOccurs="0" maxOccurs="1"/>
103+
<xsd:element name="aliases" type="CT_String" minOccurs="0"/>
104+
<xsd:element name="basedOn" type="CT_String" minOccurs="0"/>
105+
<xsd:element name="next" type="CT_String" minOccurs="0"/>
106+
<xsd:element name="link" type="CT_String" minOccurs="0"/>
107+
<xsd:element name="autoRedefine" type="CT_OnOff" minOccurs="0"/>
108+
<xsd:element name="hidden" type="CT_OnOff" minOccurs="0"/>
109+
<xsd:element name="uiPriority" type="CT_DecimalNumber" minOccurs="0"/>
110+
<xsd:element name="semiHidden" type="CT_OnOff" minOccurs="0"/>
111+
<xsd:element name="unhideWhenUsed" type="CT_OnOff" minOccurs="0"/>
112+
<xsd:element name="qFormat" type="CT_OnOff" minOccurs="0"/>
113+
<xsd:element name="locked" type="CT_OnOff" minOccurs="0"/>
114+
<xsd:element name="personal" type="CT_OnOff" minOccurs="0"/>
115+
<xsd:element name="personalCompose" type="CT_OnOff" minOccurs="0"/>
116+
<xsd:element name="personalReply" type="CT_OnOff" minOccurs="0"/>
117+
<xsd:element name="rsid" type="CT_LongHexNumber" minOccurs="0"/>
118+
<xsd:element name="pPr" type="CT_PPrGeneral" minOccurs="0" maxOccurs="1"/>
119+
<xsd:element name="rPr" type="CT_RPr" minOccurs="0" maxOccurs="1"/>
120+
<xsd:element name="tblPr" type="CT_TblPrBase" minOccurs="0" maxOccurs="1"/>
121+
<xsd:element name="trPr" type="CT_TrPr" minOccurs="0" maxOccurs="1"/>
122+
<xsd:element name="tcPr" type="CT_TcPr" minOccurs="0" maxOccurs="1"/>
123+
<xsd:element name="tblStylePr" type="CT_TblStylePr" minOccurs="0" maxOccurs="unbounded"/>
124+
</xsd:sequence>
125+
<xsd:attribute name="type" type="ST_StyleType" use="optional"/>
126+
<xsd:attribute name="styleId" type="s:ST_String" use="optional"/>
127+
<xsd:attribute name="default" type="s:ST_OnOff" use="optional"/>
128+
<xsd:attribute name="customStyle" type="s:ST_OnOff" use="optional"/>
129+
</xsd:complexType>
130+
131+
<xsd:complexType name="CT_LsdException">
132+
<xsd:attribute name="name" type="s:ST_String" use="required"/>
133+
<xsd:attribute name="locked" type="s:ST_OnOff"/>
134+
<xsd:attribute name="uiPriority" type="ST_DecimalNumber"/>
135+
<xsd:attribute name="semiHidden" type="s:ST_OnOff"/>
136+
<xsd:attribute name="unhideWhenUsed" type="s:ST_OnOff"/>
137+
<xsd:attribute name="qFormat" type="s:ST_OnOff"/>
138+
</xsd:complexType>

doc/developer/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Developer Documentation
1111
analysis/ct_body
1212
analysis/ct_p
1313
analysis/ct_ppr
14+
analysis/ct_styles

docx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from docx.api import Document # noqa
1111

12-
__version__ = '0.3.0d1'
12+
__version__ = '0.3.0dev1'
1313

1414

1515
from opc import PartFactory

0 commit comments

Comments
 (0)