ps-python-docx 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docx/__init__.py +68 -0
- docx/api.py +37 -0
- docx/blkcntnr.py +101 -0
- docx/comments.py +163 -0
- docx/dml/__init__.py +0 -0
- docx/dml/color.py +112 -0
- docx/document.py +275 -0
- docx/drawing/__init__.py +59 -0
- docx/enum/__init__.py +0 -0
- docx/enum/base.py +150 -0
- docx/enum/dml.py +103 -0
- docx/enum/section.py +86 -0
- docx/enum/shape.py +19 -0
- docx/enum/style.py +452 -0
- docx/enum/table.py +136 -0
- docx/enum/text.py +367 -0
- docx/exceptions.py +18 -0
- docx/image/__init__.py +23 -0
- docx/image/bmp.py +43 -0
- docx/image/constants.py +172 -0
- docx/image/exceptions.py +13 -0
- docx/image/gif.py +38 -0
- docx/image/helpers.py +86 -0
- docx/image/image.py +234 -0
- docx/image/jpeg.py +425 -0
- docx/image/png.py +253 -0
- docx/image/tiff.py +289 -0
- docx/opc/__init__.py +0 -0
- docx/opc/constants.py +306 -0
- docx/opc/coreprops.py +142 -0
- docx/opc/exceptions.py +12 -0
- docx/opc/oxml.py +247 -0
- docx/opc/package.py +219 -0
- docx/opc/packuri.py +109 -0
- docx/opc/part.py +247 -0
- docx/opc/parts/__init__.py +0 -0
- docx/opc/parts/coreprops.py +48 -0
- docx/opc/phys_pkg.py +119 -0
- docx/opc/pkgreader.py +254 -0
- docx/opc/pkgwriter.py +115 -0
- docx/opc/rel.py +153 -0
- docx/opc/shared.py +31 -0
- docx/opc/spec.py +24 -0
- docx/oxml/__init__.py +261 -0
- docx/oxml/comments.py +124 -0
- docx/oxml/coreprops.py +298 -0
- docx/oxml/document.py +88 -0
- docx/oxml/drawing.py +11 -0
- docx/oxml/exceptions.py +10 -0
- docx/oxml/ns.py +109 -0
- docx/oxml/numbering.py +109 -0
- docx/oxml/parser.py +62 -0
- docx/oxml/section.py +537 -0
- docx/oxml/settings.py +138 -0
- docx/oxml/shape.py +299 -0
- docx/oxml/shared.py +52 -0
- docx/oxml/simpletypes.py +434 -0
- docx/oxml/styles.py +341 -0
- docx/oxml/table.py +977 -0
- docx/oxml/text/__init__.py +0 -0
- docx/oxml/text/font.py +333 -0
- docx/oxml/text/hyperlink.py +45 -0
- docx/oxml/text/pagebreak.py +278 -0
- docx/oxml/text/paragraph.py +106 -0
- docx/oxml/text/parfmt.py +392 -0
- docx/oxml/text/run.py +307 -0
- docx/oxml/xmlchemy.py +696 -0
- docx/package.py +110 -0
- docx/parts/__init__.py +0 -0
- docx/parts/comments.py +51 -0
- docx/parts/document.py +182 -0
- docx/parts/hdrftr.py +53 -0
- docx/parts/image.py +80 -0
- docx/parts/numbering.py +32 -0
- docx/parts/settings.py +50 -0
- docx/parts/story.py +95 -0
- docx/parts/styles.py +42 -0
- docx/parts/theme.py +53 -0
- docx/py.typed +0 -0
- docx/section.py +479 -0
- docx/settings.py +35 -0
- docx/shape.py +103 -0
- docx/shared.py +382 -0
- docx/styles/__init__.py +40 -0
- docx/styles/latent.py +198 -0
- docx/styles/style.py +264 -0
- docx/styles/styles.py +147 -0
- docx/table.py +537 -0
- docx/templates/default-comments.xml +12 -0
- docx/templates/default-docx-template/[Content_Types].xml +17 -0
- docx/templates/default-docx-template/_rels/.rels +7 -0
- docx/templates/default-docx-template/customXml/_rels/item1.xml.rels +4 -0
- docx/templates/default-docx-template/customXml/item1.xml +2 -0
- docx/templates/default-docx-template/customXml/itemProps1.xml +6 -0
- docx/templates/default-docx-template/docProps/app.xml +36 -0
- docx/templates/default-docx-template/docProps/core.xml +13 -0
- docx/templates/default-docx-template/docProps/thumbnail.jpeg +0 -0
- docx/templates/default-docx-template/word/_rels/document.xml.rels +11 -0
- docx/templates/default-docx-template/word/document.xml +11 -0
- docx/templates/default-docx-template/word/fontTable.xml +61 -0
- docx/templates/default-docx-template/word/numbering.xml +201 -0
- docx/templates/default-docx-template/word/settings.xml +53 -0
- docx/templates/default-docx-template/word/styles.xml +11844 -0
- docx/templates/default-docx-template/word/stylesWithEffects.xml +11800 -0
- docx/templates/default-docx-template/word/theme/theme1.xml +318 -0
- docx/templates/default-docx-template/word/webSettings.xml +5 -0
- docx/templates/default-footer.xml +27 -0
- docx/templates/default-header.xml +27 -0
- docx/templates/default-settings.xml +26 -0
- docx/templates/default-styles.xml +190 -0
- docx/templates/default.docx +0 -0
- docx/text/__init__.py +0 -0
- docx/text/font.py +472 -0
- docx/text/hyperlink.py +121 -0
- docx/text/pagebreak.py +104 -0
- docx/text/paragraph.py +173 -0
- docx/text/parfmt.py +286 -0
- docx/text/run.py +257 -0
- docx/text/tabstops.py +123 -0
- docx/theme.py +67 -0
- docx/types.py +34 -0
- ps_python_docx-1.3.0.dist-info/METADATA +77 -0
- ps_python_docx-1.3.0.dist-info/RECORD +126 -0
- ps_python_docx-1.3.0.dist-info/WHEEL +5 -0
- ps_python_docx-1.3.0.dist-info/licenses/LICENSE +20 -0
- ps_python_docx-1.3.0.dist-info/top_level.txt +1 -0
docx/enum/shape.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Enumerations related to DrawingML shapes in WordprocessingML files."""
|
|
2
|
+
|
|
3
|
+
import enum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WD_INLINE_SHAPE_TYPE(enum.Enum):
|
|
7
|
+
"""Corresponds to WdInlineShapeType enumeration.
|
|
8
|
+
|
|
9
|
+
http://msdn.microsoft.com/en-us/library/office/ff192587.aspx.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
CHART = 12
|
|
13
|
+
LINKED_PICTURE = 4
|
|
14
|
+
PICTURE = 3
|
|
15
|
+
SMART_ART = 15
|
|
16
|
+
NOT_IMPLEMENTED = -6
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
WD_INLINE_SHAPE = WD_INLINE_SHAPE_TYPE
|
docx/enum/style.py
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
"""Enumerations related to styles."""
|
|
2
|
+
|
|
3
|
+
from .base import BaseEnum, BaseXmlEnum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WD_BUILTIN_STYLE(BaseEnum):
|
|
7
|
+
"""Alias: **WD_STYLE**
|
|
8
|
+
|
|
9
|
+
Specifies a built-in Microsoft Word style.
|
|
10
|
+
|
|
11
|
+
Example::
|
|
12
|
+
|
|
13
|
+
from docx import Document
|
|
14
|
+
from docx.enum.style import WD_STYLE
|
|
15
|
+
|
|
16
|
+
document = Document()
|
|
17
|
+
styles = document.styles
|
|
18
|
+
style = styles[WD_STYLE.BODY_TEXT]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
MS API name: `WdBuiltinStyle`
|
|
22
|
+
|
|
23
|
+
http://msdn.microsoft.com/en-us/library/office/ff835210.aspx
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
BLOCK_QUOTATION = (-85, "Block Text.")
|
|
27
|
+
"""Block Text."""
|
|
28
|
+
|
|
29
|
+
BODY_TEXT = (-67, "Body Text.")
|
|
30
|
+
"""Body Text."""
|
|
31
|
+
|
|
32
|
+
BODY_TEXT_2 = (-81, "Body Text 2.")
|
|
33
|
+
"""Body Text 2."""
|
|
34
|
+
|
|
35
|
+
BODY_TEXT_3 = (-82, "Body Text 3.")
|
|
36
|
+
"""Body Text 3."""
|
|
37
|
+
|
|
38
|
+
BODY_TEXT_FIRST_INDENT = (-78, "Body Text First Indent.")
|
|
39
|
+
"""Body Text First Indent."""
|
|
40
|
+
|
|
41
|
+
BODY_TEXT_FIRST_INDENT_2 = (-79, "Body Text First Indent 2.")
|
|
42
|
+
"""Body Text First Indent 2."""
|
|
43
|
+
|
|
44
|
+
BODY_TEXT_INDENT = (-68, "Body Text Indent.")
|
|
45
|
+
"""Body Text Indent."""
|
|
46
|
+
|
|
47
|
+
BODY_TEXT_INDENT_2 = (-83, "Body Text Indent 2.")
|
|
48
|
+
"""Body Text Indent 2."""
|
|
49
|
+
|
|
50
|
+
BODY_TEXT_INDENT_3 = (-84, "Body Text Indent 3.")
|
|
51
|
+
"""Body Text Indent 3."""
|
|
52
|
+
|
|
53
|
+
BOOK_TITLE = (-265, "Book Title.")
|
|
54
|
+
"""Book Title."""
|
|
55
|
+
|
|
56
|
+
CAPTION = (-35, "Caption.")
|
|
57
|
+
"""Caption."""
|
|
58
|
+
|
|
59
|
+
CLOSING = (-64, "Closing.")
|
|
60
|
+
"""Closing."""
|
|
61
|
+
|
|
62
|
+
COMMENT_REFERENCE = (-40, "Comment Reference.")
|
|
63
|
+
"""Comment Reference."""
|
|
64
|
+
|
|
65
|
+
COMMENT_TEXT = (-31, "Comment Text.")
|
|
66
|
+
"""Comment Text."""
|
|
67
|
+
|
|
68
|
+
DATE = (-77, "Date.")
|
|
69
|
+
"""Date."""
|
|
70
|
+
|
|
71
|
+
DEFAULT_PARAGRAPH_FONT = (-66, "Default Paragraph Font.")
|
|
72
|
+
"""Default Paragraph Font."""
|
|
73
|
+
|
|
74
|
+
EMPHASIS = (-89, "Emphasis.")
|
|
75
|
+
"""Emphasis."""
|
|
76
|
+
|
|
77
|
+
ENDNOTE_REFERENCE = (-43, "Endnote Reference.")
|
|
78
|
+
"""Endnote Reference."""
|
|
79
|
+
|
|
80
|
+
ENDNOTE_TEXT = (-44, "Endnote Text.")
|
|
81
|
+
"""Endnote Text."""
|
|
82
|
+
|
|
83
|
+
ENVELOPE_ADDRESS = (-37, "Envelope Address.")
|
|
84
|
+
"""Envelope Address."""
|
|
85
|
+
|
|
86
|
+
ENVELOPE_RETURN = (-38, "Envelope Return.")
|
|
87
|
+
"""Envelope Return."""
|
|
88
|
+
|
|
89
|
+
FOOTER = (-33, "Footer.")
|
|
90
|
+
"""Footer."""
|
|
91
|
+
|
|
92
|
+
FOOTNOTE_REFERENCE = (-39, "Footnote Reference.")
|
|
93
|
+
"""Footnote Reference."""
|
|
94
|
+
|
|
95
|
+
FOOTNOTE_TEXT = (-30, "Footnote Text.")
|
|
96
|
+
"""Footnote Text."""
|
|
97
|
+
|
|
98
|
+
HEADER = (-32, "Header.")
|
|
99
|
+
"""Header."""
|
|
100
|
+
|
|
101
|
+
HEADING_1 = (-2, "Heading 1.")
|
|
102
|
+
"""Heading 1."""
|
|
103
|
+
|
|
104
|
+
HEADING_2 = (-3, "Heading 2.")
|
|
105
|
+
"""Heading 2."""
|
|
106
|
+
|
|
107
|
+
HEADING_3 = (-4, "Heading 3.")
|
|
108
|
+
"""Heading 3."""
|
|
109
|
+
|
|
110
|
+
HEADING_4 = (-5, "Heading 4.")
|
|
111
|
+
"""Heading 4."""
|
|
112
|
+
|
|
113
|
+
HEADING_5 = (-6, "Heading 5.")
|
|
114
|
+
"""Heading 5."""
|
|
115
|
+
|
|
116
|
+
HEADING_6 = (-7, "Heading 6.")
|
|
117
|
+
"""Heading 6."""
|
|
118
|
+
|
|
119
|
+
HEADING_7 = (-8, "Heading 7.")
|
|
120
|
+
"""Heading 7."""
|
|
121
|
+
|
|
122
|
+
HEADING_8 = (-9, "Heading 8.")
|
|
123
|
+
"""Heading 8."""
|
|
124
|
+
|
|
125
|
+
HEADING_9 = (-10, "Heading 9.")
|
|
126
|
+
"""Heading 9."""
|
|
127
|
+
|
|
128
|
+
HTML_ACRONYM = (-96, "HTML Acronym.")
|
|
129
|
+
"""HTML Acronym."""
|
|
130
|
+
|
|
131
|
+
HTML_ADDRESS = (-97, "HTML Address.")
|
|
132
|
+
"""HTML Address."""
|
|
133
|
+
|
|
134
|
+
HTML_CITE = (-98, "HTML Cite.")
|
|
135
|
+
"""HTML Cite."""
|
|
136
|
+
|
|
137
|
+
HTML_CODE = (-99, "HTML Code.")
|
|
138
|
+
"""HTML Code."""
|
|
139
|
+
|
|
140
|
+
HTML_DFN = (-100, "HTML Definition.")
|
|
141
|
+
"""HTML Definition."""
|
|
142
|
+
|
|
143
|
+
HTML_KBD = (-101, "HTML Keyboard.")
|
|
144
|
+
"""HTML Keyboard."""
|
|
145
|
+
|
|
146
|
+
HTML_NORMAL = (-95, "Normal (Web).")
|
|
147
|
+
"""Normal (Web)."""
|
|
148
|
+
|
|
149
|
+
HTML_PRE = (-102, "HTML Preformatted.")
|
|
150
|
+
"""HTML Preformatted."""
|
|
151
|
+
|
|
152
|
+
HTML_SAMP = (-103, "HTML Sample.")
|
|
153
|
+
"""HTML Sample."""
|
|
154
|
+
|
|
155
|
+
HTML_TT = (-104, "HTML Typewriter.")
|
|
156
|
+
"""HTML Typewriter."""
|
|
157
|
+
|
|
158
|
+
HTML_VAR = (-105, "HTML Variable.")
|
|
159
|
+
"""HTML Variable."""
|
|
160
|
+
|
|
161
|
+
HYPERLINK = (-86, "Hyperlink.")
|
|
162
|
+
"""Hyperlink."""
|
|
163
|
+
|
|
164
|
+
HYPERLINK_FOLLOWED = (-87, "Followed Hyperlink.")
|
|
165
|
+
"""Followed Hyperlink."""
|
|
166
|
+
|
|
167
|
+
INDEX_1 = (-11, "Index 1.")
|
|
168
|
+
"""Index 1."""
|
|
169
|
+
|
|
170
|
+
INDEX_2 = (-12, "Index 2.")
|
|
171
|
+
"""Index 2."""
|
|
172
|
+
|
|
173
|
+
INDEX_3 = (-13, "Index 3.")
|
|
174
|
+
"""Index 3."""
|
|
175
|
+
|
|
176
|
+
INDEX_4 = (-14, "Index 4.")
|
|
177
|
+
"""Index 4."""
|
|
178
|
+
|
|
179
|
+
INDEX_5 = (-15, "Index 5.")
|
|
180
|
+
"""Index 5."""
|
|
181
|
+
|
|
182
|
+
INDEX_6 = (-16, "Index 6.")
|
|
183
|
+
"""Index 6."""
|
|
184
|
+
|
|
185
|
+
INDEX_7 = (-17, "Index 7.")
|
|
186
|
+
"""Index 7."""
|
|
187
|
+
|
|
188
|
+
INDEX_8 = (-18, "Index 8.")
|
|
189
|
+
"""Index 8."""
|
|
190
|
+
|
|
191
|
+
INDEX_9 = (-19, "Index 9.")
|
|
192
|
+
"""Index 9."""
|
|
193
|
+
|
|
194
|
+
INDEX_HEADING = (-34, "Index Heading")
|
|
195
|
+
"""Index Heading"""
|
|
196
|
+
|
|
197
|
+
INTENSE_EMPHASIS = (-262, "Intense Emphasis.")
|
|
198
|
+
"""Intense Emphasis."""
|
|
199
|
+
|
|
200
|
+
INTENSE_QUOTE = (-182, "Intense Quote.")
|
|
201
|
+
"""Intense Quote."""
|
|
202
|
+
|
|
203
|
+
INTENSE_REFERENCE = (-264, "Intense Reference.")
|
|
204
|
+
"""Intense Reference."""
|
|
205
|
+
|
|
206
|
+
LINE_NUMBER = (-41, "Line Number.")
|
|
207
|
+
"""Line Number."""
|
|
208
|
+
|
|
209
|
+
LIST = (-48, "List.")
|
|
210
|
+
"""List."""
|
|
211
|
+
|
|
212
|
+
LIST_2 = (-51, "List 2.")
|
|
213
|
+
"""List 2."""
|
|
214
|
+
|
|
215
|
+
LIST_3 = (-52, "List 3.")
|
|
216
|
+
"""List 3."""
|
|
217
|
+
|
|
218
|
+
LIST_4 = (-53, "List 4.")
|
|
219
|
+
"""List 4."""
|
|
220
|
+
|
|
221
|
+
LIST_5 = (-54, "List 5.")
|
|
222
|
+
"""List 5."""
|
|
223
|
+
|
|
224
|
+
LIST_BULLET = (-49, "List Bullet.")
|
|
225
|
+
"""List Bullet."""
|
|
226
|
+
|
|
227
|
+
LIST_BULLET_2 = (-55, "List Bullet 2.")
|
|
228
|
+
"""List Bullet 2."""
|
|
229
|
+
|
|
230
|
+
LIST_BULLET_3 = (-56, "List Bullet 3.")
|
|
231
|
+
"""List Bullet 3."""
|
|
232
|
+
|
|
233
|
+
LIST_BULLET_4 = (-57, "List Bullet 4.")
|
|
234
|
+
"""List Bullet 4."""
|
|
235
|
+
|
|
236
|
+
LIST_BULLET_5 = (-58, "List Bullet 5.")
|
|
237
|
+
"""List Bullet 5."""
|
|
238
|
+
|
|
239
|
+
LIST_CONTINUE = (-69, "List Continue.")
|
|
240
|
+
"""List Continue."""
|
|
241
|
+
|
|
242
|
+
LIST_CONTINUE_2 = (-70, "List Continue 2.")
|
|
243
|
+
"""List Continue 2."""
|
|
244
|
+
|
|
245
|
+
LIST_CONTINUE_3 = (-71, "List Continue 3.")
|
|
246
|
+
"""List Continue 3."""
|
|
247
|
+
|
|
248
|
+
LIST_CONTINUE_4 = (-72, "List Continue 4.")
|
|
249
|
+
"""List Continue 4."""
|
|
250
|
+
|
|
251
|
+
LIST_CONTINUE_5 = (-73, "List Continue 5.")
|
|
252
|
+
"""List Continue 5."""
|
|
253
|
+
|
|
254
|
+
LIST_NUMBER = (-50, "List Number.")
|
|
255
|
+
"""List Number."""
|
|
256
|
+
|
|
257
|
+
LIST_NUMBER_2 = (-59, "List Number 2.")
|
|
258
|
+
"""List Number 2."""
|
|
259
|
+
|
|
260
|
+
LIST_NUMBER_3 = (-60, "List Number 3.")
|
|
261
|
+
"""List Number 3."""
|
|
262
|
+
|
|
263
|
+
LIST_NUMBER_4 = (-61, "List Number 4.")
|
|
264
|
+
"""List Number 4."""
|
|
265
|
+
|
|
266
|
+
LIST_NUMBER_5 = (-62, "List Number 5.")
|
|
267
|
+
"""List Number 5."""
|
|
268
|
+
|
|
269
|
+
LIST_PARAGRAPH = (-180, "List Paragraph.")
|
|
270
|
+
"""List Paragraph."""
|
|
271
|
+
|
|
272
|
+
MACRO_TEXT = (-46, "Macro Text.")
|
|
273
|
+
"""Macro Text."""
|
|
274
|
+
|
|
275
|
+
MESSAGE_HEADER = (-74, "Message Header.")
|
|
276
|
+
"""Message Header."""
|
|
277
|
+
|
|
278
|
+
NAV_PANE = (-90, "Document Map.")
|
|
279
|
+
"""Document Map."""
|
|
280
|
+
|
|
281
|
+
NORMAL = (-1, "Normal.")
|
|
282
|
+
"""Normal."""
|
|
283
|
+
|
|
284
|
+
NORMAL_INDENT = (-29, "Normal Indent.")
|
|
285
|
+
"""Normal Indent."""
|
|
286
|
+
|
|
287
|
+
NORMAL_OBJECT = (-158, "Normal (applied to an object).")
|
|
288
|
+
"""Normal (applied to an object)."""
|
|
289
|
+
|
|
290
|
+
NORMAL_TABLE = (-106, "Normal (applied within a table).")
|
|
291
|
+
"""Normal (applied within a table)."""
|
|
292
|
+
|
|
293
|
+
NOTE_HEADING = (-80, "Note Heading.")
|
|
294
|
+
"""Note Heading."""
|
|
295
|
+
|
|
296
|
+
PAGE_NUMBER = (-42, "Page Number.")
|
|
297
|
+
"""Page Number."""
|
|
298
|
+
|
|
299
|
+
PLAIN_TEXT = (-91, "Plain Text.")
|
|
300
|
+
"""Plain Text."""
|
|
301
|
+
|
|
302
|
+
QUOTE = (-181, "Quote.")
|
|
303
|
+
"""Quote."""
|
|
304
|
+
|
|
305
|
+
SALUTATION = (-76, "Salutation.")
|
|
306
|
+
"""Salutation."""
|
|
307
|
+
|
|
308
|
+
SIGNATURE = (-65, "Signature.")
|
|
309
|
+
"""Signature."""
|
|
310
|
+
|
|
311
|
+
STRONG = (-88, "Strong.")
|
|
312
|
+
"""Strong."""
|
|
313
|
+
|
|
314
|
+
SUBTITLE = (-75, "Subtitle.")
|
|
315
|
+
"""Subtitle."""
|
|
316
|
+
|
|
317
|
+
SUBTLE_EMPHASIS = (-261, "Subtle Emphasis.")
|
|
318
|
+
"""Subtle Emphasis."""
|
|
319
|
+
|
|
320
|
+
SUBTLE_REFERENCE = (-263, "Subtle Reference.")
|
|
321
|
+
"""Subtle Reference."""
|
|
322
|
+
|
|
323
|
+
TABLE_COLORFUL_GRID = (-172, "Colorful Grid.")
|
|
324
|
+
"""Colorful Grid."""
|
|
325
|
+
|
|
326
|
+
TABLE_COLORFUL_LIST = (-171, "Colorful List.")
|
|
327
|
+
"""Colorful List."""
|
|
328
|
+
|
|
329
|
+
TABLE_COLORFUL_SHADING = (-170, "Colorful Shading.")
|
|
330
|
+
"""Colorful Shading."""
|
|
331
|
+
|
|
332
|
+
TABLE_DARK_LIST = (-169, "Dark List.")
|
|
333
|
+
"""Dark List."""
|
|
334
|
+
|
|
335
|
+
TABLE_LIGHT_GRID = (-161, "Light Grid.")
|
|
336
|
+
"""Light Grid."""
|
|
337
|
+
|
|
338
|
+
TABLE_LIGHT_GRID_ACCENT_1 = (-175, "Light Grid Accent 1.")
|
|
339
|
+
"""Light Grid Accent 1."""
|
|
340
|
+
|
|
341
|
+
TABLE_LIGHT_LIST = (-160, "Light List.")
|
|
342
|
+
"""Light List."""
|
|
343
|
+
|
|
344
|
+
TABLE_LIGHT_LIST_ACCENT_1 = (-174, "Light List Accent 1.")
|
|
345
|
+
"""Light List Accent 1."""
|
|
346
|
+
|
|
347
|
+
TABLE_LIGHT_SHADING = (-159, "Light Shading.")
|
|
348
|
+
"""Light Shading."""
|
|
349
|
+
|
|
350
|
+
TABLE_LIGHT_SHADING_ACCENT_1 = (-173, "Light Shading Accent 1.")
|
|
351
|
+
"""Light Shading Accent 1."""
|
|
352
|
+
|
|
353
|
+
TABLE_MEDIUM_GRID_1 = (-166, "Medium Grid 1.")
|
|
354
|
+
"""Medium Grid 1."""
|
|
355
|
+
|
|
356
|
+
TABLE_MEDIUM_GRID_2 = (-167, "Medium Grid 2.")
|
|
357
|
+
"""Medium Grid 2."""
|
|
358
|
+
|
|
359
|
+
TABLE_MEDIUM_GRID_3 = (-168, "Medium Grid 3.")
|
|
360
|
+
"""Medium Grid 3."""
|
|
361
|
+
|
|
362
|
+
TABLE_MEDIUM_LIST_1 = (-164, "Medium List 1.")
|
|
363
|
+
"""Medium List 1."""
|
|
364
|
+
|
|
365
|
+
TABLE_MEDIUM_LIST_1_ACCENT_1 = (-178, "Medium List 1 Accent 1.")
|
|
366
|
+
"""Medium List 1 Accent 1."""
|
|
367
|
+
|
|
368
|
+
TABLE_MEDIUM_LIST_2 = (-165, "Medium List 2.")
|
|
369
|
+
"""Medium List 2."""
|
|
370
|
+
|
|
371
|
+
TABLE_MEDIUM_SHADING_1 = (-162, "Medium Shading 1.")
|
|
372
|
+
"""Medium Shading 1."""
|
|
373
|
+
|
|
374
|
+
TABLE_MEDIUM_SHADING_1_ACCENT_1 = (-176, "Medium Shading 1 Accent 1.")
|
|
375
|
+
"""Medium Shading 1 Accent 1."""
|
|
376
|
+
|
|
377
|
+
TABLE_MEDIUM_SHADING_2 = (-163, "Medium Shading 2.")
|
|
378
|
+
"""Medium Shading 2."""
|
|
379
|
+
|
|
380
|
+
TABLE_MEDIUM_SHADING_2_ACCENT_1 = (-177, "Medium Shading 2 Accent 1.")
|
|
381
|
+
"""Medium Shading 2 Accent 1."""
|
|
382
|
+
|
|
383
|
+
TABLE_OF_AUTHORITIES = (-45, "Table of Authorities.")
|
|
384
|
+
"""Table of Authorities."""
|
|
385
|
+
|
|
386
|
+
TABLE_OF_FIGURES = (-36, "Table of Figures.")
|
|
387
|
+
"""Table of Figures."""
|
|
388
|
+
|
|
389
|
+
TITLE = (-63, "Title.")
|
|
390
|
+
"""Title."""
|
|
391
|
+
|
|
392
|
+
TOAHEADING = (-47, "TOA Heading.")
|
|
393
|
+
"""TOA Heading."""
|
|
394
|
+
|
|
395
|
+
TOC_1 = (-20, "TOC 1.")
|
|
396
|
+
"""TOC 1."""
|
|
397
|
+
|
|
398
|
+
TOC_2 = (-21, "TOC 2.")
|
|
399
|
+
"""TOC 2."""
|
|
400
|
+
|
|
401
|
+
TOC_3 = (-22, "TOC 3.")
|
|
402
|
+
"""TOC 3."""
|
|
403
|
+
|
|
404
|
+
TOC_4 = (-23, "TOC 4.")
|
|
405
|
+
"""TOC 4."""
|
|
406
|
+
|
|
407
|
+
TOC_5 = (-24, "TOC 5.")
|
|
408
|
+
"""TOC 5."""
|
|
409
|
+
|
|
410
|
+
TOC_6 = (-25, "TOC 6.")
|
|
411
|
+
"""TOC 6."""
|
|
412
|
+
|
|
413
|
+
TOC_7 = (-26, "TOC 7.")
|
|
414
|
+
"""TOC 7."""
|
|
415
|
+
|
|
416
|
+
TOC_8 = (-27, "TOC 8.")
|
|
417
|
+
"""TOC 8."""
|
|
418
|
+
|
|
419
|
+
TOC_9 = (-28, "TOC 9.")
|
|
420
|
+
"""TOC 9."""
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
WD_STYLE = WD_BUILTIN_STYLE
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
class WD_STYLE_TYPE(BaseXmlEnum):
|
|
427
|
+
"""Specifies one of the four style types: paragraph, character, list, or table.
|
|
428
|
+
|
|
429
|
+
Example::
|
|
430
|
+
|
|
431
|
+
from docx import Document
|
|
432
|
+
from docx.enum.style import WD_STYLE_TYPE
|
|
433
|
+
|
|
434
|
+
styles = Document().styles
|
|
435
|
+
assert styles[0].type == WD_STYLE_TYPE.PARAGRAPH
|
|
436
|
+
|
|
437
|
+
MS API name: `WdStyleType`
|
|
438
|
+
|
|
439
|
+
http://msdn.microsoft.com/en-us/library/office/ff196870.aspx
|
|
440
|
+
"""
|
|
441
|
+
|
|
442
|
+
CHARACTER = (2, "character", "Character style.")
|
|
443
|
+
"""Character style."""
|
|
444
|
+
|
|
445
|
+
LIST = (4, "numbering", "List style.")
|
|
446
|
+
"""List style."""
|
|
447
|
+
|
|
448
|
+
PARAGRAPH = (1, "paragraph", "Paragraph style.")
|
|
449
|
+
"""Paragraph style."""
|
|
450
|
+
|
|
451
|
+
TABLE = (3, "table", "Table style.")
|
|
452
|
+
"""Table style."""
|
docx/enum/table.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Enumerations related to tables in WordprocessingML files."""
|
|
2
|
+
|
|
3
|
+
from docx.enum.base import BaseEnum, BaseXmlEnum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WD_CELL_VERTICAL_ALIGNMENT(BaseXmlEnum):
|
|
7
|
+
"""Alias: **WD_ALIGN_VERTICAL**
|
|
8
|
+
|
|
9
|
+
Specifies the vertical alignment of text in one or more cells of a table.
|
|
10
|
+
|
|
11
|
+
Example::
|
|
12
|
+
|
|
13
|
+
from docx.enum.table import WD_ALIGN_VERTICAL
|
|
14
|
+
|
|
15
|
+
table = document.add_table(3, 3)
|
|
16
|
+
table.cell(0, 0).vertical_alignment = WD_ALIGN_VERTICAL.BOTTOM
|
|
17
|
+
|
|
18
|
+
MS API name: `WdCellVerticalAlignment`
|
|
19
|
+
|
|
20
|
+
https://msdn.microsoft.com/en-us/library/office/ff193345.aspx
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
TOP = (0, "top", "Text is aligned to the top border of the cell.")
|
|
24
|
+
"""Text is aligned to the top border of the cell."""
|
|
25
|
+
|
|
26
|
+
CENTER = (1, "center", "Text is aligned to the center of the cell.")
|
|
27
|
+
"""Text is aligned to the center of the cell."""
|
|
28
|
+
|
|
29
|
+
BOTTOM = (3, "bottom", "Text is aligned to the bottom border of the cell.")
|
|
30
|
+
"""Text is aligned to the bottom border of the cell."""
|
|
31
|
+
|
|
32
|
+
BOTH = (
|
|
33
|
+
101,
|
|
34
|
+
"both",
|
|
35
|
+
"This is an option in the OpenXml spec, but not in Word itself. It's not"
|
|
36
|
+
" clear what Word behavior this setting produces. If you find out please"
|
|
37
|
+
" let us know and we'll update this documentation. Otherwise, probably best"
|
|
38
|
+
" to avoid this option.",
|
|
39
|
+
)
|
|
40
|
+
"""This is an option in the OpenXml spec, but not in Word itself.
|
|
41
|
+
|
|
42
|
+
It's not clear what Word behavior this setting produces. If you find out please let
|
|
43
|
+
us know and we'll update this documentation. Otherwise, probably best to avoid this
|
|
44
|
+
option.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
WD_ALIGN_VERTICAL = WD_CELL_VERTICAL_ALIGNMENT
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class WD_ROW_HEIGHT_RULE(BaseXmlEnum):
|
|
52
|
+
"""Alias: **WD_ROW_HEIGHT**
|
|
53
|
+
|
|
54
|
+
Specifies the rule for determining the height of a table row
|
|
55
|
+
|
|
56
|
+
Example::
|
|
57
|
+
|
|
58
|
+
from docx.enum.table import WD_ROW_HEIGHT_RULE
|
|
59
|
+
|
|
60
|
+
table = document.add_table(3, 3)
|
|
61
|
+
table.rows[0].height_rule = WD_ROW_HEIGHT_RULE.EXACTLY
|
|
62
|
+
|
|
63
|
+
MS API name: `WdRowHeightRule`
|
|
64
|
+
|
|
65
|
+
https://msdn.microsoft.com/en-us/library/office/ff193620.aspx
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
AUTO = (
|
|
69
|
+
0,
|
|
70
|
+
"auto",
|
|
71
|
+
"The row height is adjusted to accommodate the tallest value in the row.",
|
|
72
|
+
)
|
|
73
|
+
"""The row height is adjusted to accommodate the tallest value in the row."""
|
|
74
|
+
|
|
75
|
+
AT_LEAST = (1, "atLeast", "The row height is at least a minimum specified value.")
|
|
76
|
+
"""The row height is at least a minimum specified value."""
|
|
77
|
+
|
|
78
|
+
EXACTLY = (2, "exact", "The row height is an exact value.")
|
|
79
|
+
"""The row height is an exact value."""
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
WD_ROW_HEIGHT = WD_ROW_HEIGHT_RULE
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class WD_TABLE_ALIGNMENT(BaseXmlEnum):
|
|
86
|
+
"""Specifies table justification type.
|
|
87
|
+
|
|
88
|
+
Example::
|
|
89
|
+
|
|
90
|
+
from docx.enum.table import WD_TABLE_ALIGNMENT
|
|
91
|
+
|
|
92
|
+
table = document.add_table(3, 3)
|
|
93
|
+
table.alignment = WD_TABLE_ALIGNMENT.CENTER
|
|
94
|
+
|
|
95
|
+
MS API name: `WdRowAlignment`
|
|
96
|
+
|
|
97
|
+
http://office.microsoft.com/en-us/word-help/HV080607259.aspx
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
LEFT = (0, "left", "Left-aligned")
|
|
101
|
+
"""Left-aligned"""
|
|
102
|
+
|
|
103
|
+
CENTER = (1, "center", "Center-aligned.")
|
|
104
|
+
"""Center-aligned."""
|
|
105
|
+
|
|
106
|
+
RIGHT = (2, "right", "Right-aligned.")
|
|
107
|
+
"""Right-aligned."""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class WD_TABLE_DIRECTION(BaseEnum):
|
|
111
|
+
"""Specifies the direction in which an application orders cells in the specified
|
|
112
|
+
table or row.
|
|
113
|
+
|
|
114
|
+
Example::
|
|
115
|
+
|
|
116
|
+
from docx.enum.table import WD_TABLE_DIRECTION
|
|
117
|
+
|
|
118
|
+
table = document.add_table(3, 3)
|
|
119
|
+
table.direction = WD_TABLE_DIRECTION.RTL
|
|
120
|
+
|
|
121
|
+
MS API name: `WdTableDirection`
|
|
122
|
+
|
|
123
|
+
http://msdn.microsoft.com/en-us/library/ff835141.aspx
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
LTR = (
|
|
127
|
+
0,
|
|
128
|
+
"The table or row is arranged with the first column in the leftmost position.",
|
|
129
|
+
)
|
|
130
|
+
"""The table or row is arranged with the first column in the leftmost position."""
|
|
131
|
+
|
|
132
|
+
RTL = (
|
|
133
|
+
1,
|
|
134
|
+
"The table or row is arranged with the first column in the rightmost position.",
|
|
135
|
+
)
|
|
136
|
+
"""The table or row is arranged with the first column in the rightmost position."""
|