python-docx-oss 0.1.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 +71 -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 +285 -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 +32 -0
- docx/image/bmp.py +43 -0
- docx/image/constants.py +172 -0
- docx/image/emf.py +46 -0
- docx/image/exceptions.py +13 -0
- docx/image/gif.py +38 -0
- docx/image/helpers.py +86 -0
- docx/image/image.py +237 -0
- docx/image/jpeg.py +469 -0
- docx/image/png.py +253 -0
- docx/image/svg.py +118 -0
- docx/image/tiff.py +289 -0
- docx/opc/__init__.py +0 -0
- docx/opc/constants.py +307 -0
- docx/opc/coreprops.py +142 -0
- docx/opc/customprops.py +59 -0
- docx/opc/exceptions.py +12 -0
- docx/opc/oxml.py +247 -0
- docx/opc/package.py +254 -0
- docx/opc/packuri.py +109 -0
- docx/opc/part.py +267 -0
- docx/opc/parts/__init__.py +0 -0
- docx/opc/parts/coreprops.py +48 -0
- docx/opc/parts/customprops.py +61 -0
- docx/opc/phys_pkg.py +119 -0
- docx/opc/pkgreader.py +254 -0
- docx/opc/pkgwriter.py +115 -0
- docx/opc/rel.py +169 -0
- docx/opc/shared.py +31 -0
- docx/opc/spec.py +24 -0
- docx/oxml/__init__.py +252 -0
- docx/oxml/comments.py +124 -0
- docx/oxml/coreprops.py +298 -0
- docx/oxml/customprops.py +141 -0
- docx/oxml/dml/CT_ExtensionList.py +48 -0
- docx/oxml/document.py +88 -0
- docx/oxml/drawing.py +11 -0
- docx/oxml/exceptions.py +10 -0
- docx/oxml/ns.py +111 -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 +426 -0
- docx/oxml/shared.py +52 -0
- docx/oxml/simpletypes.py +434 -0
- docx/oxml/styles.py +320 -0
- docx/oxml/table.py +977 -0
- docx/oxml/text/__init__.py +0 -0
- docx/oxml/text/font.py +358 -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 +316 -0
- docx/oxml/xmlchemy.py +711 -0
- docx/package.py +119 -0
- docx/parts/__init__.py +0 -0
- docx/parts/comments.py +51 -0
- docx/parts/customxml.py +67 -0
- docx/parts/document.py +193 -0
- docx/parts/hdrftr.py +53 -0
- docx/parts/image.py +80 -0
- docx/parts/numbering.py +51 -0
- docx/parts/settings.py +50 -0
- docx/parts/story.py +113 -0
- docx/parts/styles.py +42 -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 +254 -0
- docx/styles/styles.py +136 -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-numbering.xml +20 -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 +466 -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 +272 -0
- docx/text/tabstops.py +123 -0
- docx/types.py +34 -0
- python_docx_oss-0.1.0.dist-info/METADATA +57 -0
- python_docx_oss-0.1.0.dist-info/RECORD +132 -0
- python_docx_oss-0.1.0.dist-info/WHEEL +5 -0
- python_docx_oss-0.1.0.dist-info/licenses/LICENSE +21 -0
- python_docx_oss-0.1.0.dist-info/top_level.txt +1 -0
docx/opc/constants.py
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"""Constant values related to the Open Packaging Convention.
|
|
2
|
+
|
|
3
|
+
In particular it includes content types and relationship types.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CONTENT_TYPE:
|
|
8
|
+
"""Content type URIs (like MIME-types) that specify a part's format."""
|
|
9
|
+
|
|
10
|
+
BMP = "image/bmp"
|
|
11
|
+
DML_CHART = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
|
|
12
|
+
DML_CHARTSHAPES = "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml"
|
|
13
|
+
DML_DIAGRAM_COLORS = "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml"
|
|
14
|
+
DML_DIAGRAM_DATA = "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml"
|
|
15
|
+
DML_DIAGRAM_LAYOUT = "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml"
|
|
16
|
+
DML_DIAGRAM_STYLE = "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml"
|
|
17
|
+
GIF = "image/gif"
|
|
18
|
+
JPEG = "image/jpeg"
|
|
19
|
+
MS_PHOTO = "image/vnd.ms-photo"
|
|
20
|
+
OFC_CUSTOM_PROPERTIES = "application/vnd.openxmlformats-officedocument.custom-properties+xml"
|
|
21
|
+
OFC_CUSTOM_XML_PROPERTIES = (
|
|
22
|
+
"application/vnd.openxmlformats-officedocument.customXmlProperties+xml"
|
|
23
|
+
)
|
|
24
|
+
OFC_DRAWING = "application/vnd.openxmlformats-officedocument.drawing+xml"
|
|
25
|
+
OFC_EXTENDED_PROPERTIES = (
|
|
26
|
+
"application/vnd.openxmlformats-officedocument.extended-properties+xml"
|
|
27
|
+
)
|
|
28
|
+
OFC_OLE_OBJECT = "application/vnd.openxmlformats-officedocument.oleObject"
|
|
29
|
+
OFC_PACKAGE = "application/vnd.openxmlformats-officedocument.package"
|
|
30
|
+
OFC_THEME = "application/vnd.openxmlformats-officedocument.theme+xml"
|
|
31
|
+
OFC_THEME_OVERRIDE = "application/vnd.openxmlformats-officedocument.themeOverride+xml"
|
|
32
|
+
OFC_VML_DRAWING = "application/vnd.openxmlformats-officedocument.vmlDrawing"
|
|
33
|
+
OPC_CORE_PROPERTIES = "application/vnd.openxmlformats-package.core-properties+xml"
|
|
34
|
+
OPC_CUSTOM_PROPERTIES = "application/vnd.openxmlformats-officedocument.custom-properties+xml"
|
|
35
|
+
OPC_DIGITAL_SIGNATURE_CERTIFICATE = (
|
|
36
|
+
"application/vnd.openxmlformats-package.digital-signature-certificate"
|
|
37
|
+
)
|
|
38
|
+
OPC_DIGITAL_SIGNATURE_ORIGIN = "application/vnd.openxmlformats-package.digital-signature-origin"
|
|
39
|
+
OPC_DIGITAL_SIGNATURE_XMLSIGNATURE = (
|
|
40
|
+
"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml"
|
|
41
|
+
)
|
|
42
|
+
OPC_RELATIONSHIPS = "application/vnd.openxmlformats-package.relationships+xml"
|
|
43
|
+
PML_COMMENTS = "application/vnd.openxmlformats-officedocument.presentationml.comments+xml"
|
|
44
|
+
PML_COMMENT_AUTHORS = (
|
|
45
|
+
"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml"
|
|
46
|
+
)
|
|
47
|
+
PML_HANDOUT_MASTER = (
|
|
48
|
+
"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml"
|
|
49
|
+
)
|
|
50
|
+
PML_NOTES_MASTER = (
|
|
51
|
+
"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"
|
|
52
|
+
)
|
|
53
|
+
PML_NOTES_SLIDE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"
|
|
54
|
+
PML_PRESENTATION_MAIN = (
|
|
55
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
|
|
56
|
+
)
|
|
57
|
+
PML_PRES_PROPS = "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"
|
|
58
|
+
PML_PRINTER_SETTINGS = (
|
|
59
|
+
"application/vnd.openxmlformats-officedocument.presentationml.printerSettings"
|
|
60
|
+
)
|
|
61
|
+
PML_SLIDE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml"
|
|
62
|
+
PML_SLIDESHOW_MAIN = (
|
|
63
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"
|
|
64
|
+
)
|
|
65
|
+
PML_SLIDE_LAYOUT = (
|
|
66
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"
|
|
67
|
+
)
|
|
68
|
+
PML_SLIDE_MASTER = (
|
|
69
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"
|
|
70
|
+
)
|
|
71
|
+
PML_SLIDE_UPDATE_INFO = (
|
|
72
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideUpdateInfo+xml"
|
|
73
|
+
)
|
|
74
|
+
PML_TABLE_STYLES = (
|
|
75
|
+
"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"
|
|
76
|
+
)
|
|
77
|
+
PML_TAGS = "application/vnd.openxmlformats-officedocument.presentationml.tags+xml"
|
|
78
|
+
PML_TEMPLATE_MAIN = (
|
|
79
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml"
|
|
80
|
+
)
|
|
81
|
+
PML_VIEW_PROPS = "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"
|
|
82
|
+
PNG = "image/png"
|
|
83
|
+
SML_CALC_CHAIN = "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml"
|
|
84
|
+
SML_CHARTSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml"
|
|
85
|
+
SML_COMMENTS = "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"
|
|
86
|
+
SML_CONNECTIONS = "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"
|
|
87
|
+
SML_CUSTOM_PROPERTY = (
|
|
88
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty"
|
|
89
|
+
)
|
|
90
|
+
SML_DIALOGSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml"
|
|
91
|
+
SML_EXTERNAL_LINK = (
|
|
92
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
93
|
+
)
|
|
94
|
+
SML_PIVOT_CACHE_DEFINITION = (
|
|
95
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml"
|
|
96
|
+
)
|
|
97
|
+
SML_PIVOT_CACHE_RECORDS = (
|
|
98
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"
|
|
99
|
+
)
|
|
100
|
+
SML_PIVOT_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"
|
|
101
|
+
SML_PRINTER_SETTINGS = (
|
|
102
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings"
|
|
103
|
+
)
|
|
104
|
+
SML_QUERY_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml"
|
|
105
|
+
SML_REVISION_HEADERS = (
|
|
106
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml"
|
|
107
|
+
)
|
|
108
|
+
SML_REVISION_LOG = "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml"
|
|
109
|
+
SML_SHARED_STRINGS = (
|
|
110
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
|
|
111
|
+
)
|
|
112
|
+
SML_SHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
113
|
+
SML_SHEET_MAIN = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
|
|
114
|
+
SML_SHEET_METADATA = (
|
|
115
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml"
|
|
116
|
+
)
|
|
117
|
+
SML_STYLES = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
|
|
118
|
+
SML_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
|
|
119
|
+
SML_TABLE_SINGLE_CELLS = (
|
|
120
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml"
|
|
121
|
+
)
|
|
122
|
+
SML_TEMPLATE_MAIN = (
|
|
123
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
|
124
|
+
)
|
|
125
|
+
SML_USER_NAMES = "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml"
|
|
126
|
+
SML_VOLATILE_DEPENDENCIES = (
|
|
127
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml"
|
|
128
|
+
)
|
|
129
|
+
SML_WORKSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
|
|
130
|
+
TIFF = "image/tiff"
|
|
131
|
+
WML_COMMENTS = "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"
|
|
132
|
+
WML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
133
|
+
WML_DOCUMENT_GLOSSARY = (
|
|
134
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml"
|
|
135
|
+
)
|
|
136
|
+
WML_DOCUMENT_MAIN = (
|
|
137
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
|
|
138
|
+
)
|
|
139
|
+
WML_ENDNOTES = "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"
|
|
140
|
+
WML_FONT_TABLE = "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"
|
|
141
|
+
WML_FOOTER = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"
|
|
142
|
+
WML_FOOTNOTES = "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"
|
|
143
|
+
WML_HEADER = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"
|
|
144
|
+
WML_NUMBERING = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"
|
|
145
|
+
WML_PRINTER_SETTINGS = (
|
|
146
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.printerSettings"
|
|
147
|
+
)
|
|
148
|
+
WML_SETTINGS = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"
|
|
149
|
+
WML_STYLES = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"
|
|
150
|
+
WML_WEB_SETTINGS = (
|
|
151
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"
|
|
152
|
+
)
|
|
153
|
+
XML = "application/xml"
|
|
154
|
+
X_EMF = "image/x-emf"
|
|
155
|
+
X_FONTDATA = "application/x-fontdata"
|
|
156
|
+
X_FONT_TTF = "application/x-font-ttf"
|
|
157
|
+
X_WMF = "image/x-wmf"
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class NAMESPACE:
|
|
161
|
+
"""Constant values for OPC XML namespaces."""
|
|
162
|
+
|
|
163
|
+
DML_WORDPROCESSING_DRAWING = (
|
|
164
|
+
"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
|
|
165
|
+
)
|
|
166
|
+
OFC_RELATIONSHIPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
167
|
+
OPC_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
168
|
+
OPC_CONTENT_TYPES = "http://schemas.openxmlformats.org/package/2006/content-types"
|
|
169
|
+
WML_MAIN = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class RELATIONSHIP_TARGET_MODE:
|
|
173
|
+
"""Open XML relationship target modes."""
|
|
174
|
+
|
|
175
|
+
EXTERNAL = "External"
|
|
176
|
+
INTERNAL = "Internal"
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class RELATIONSHIP_TYPE:
|
|
180
|
+
AUDIO = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"
|
|
181
|
+
A_F_CHUNK = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"
|
|
182
|
+
CALC_CHAIN = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain"
|
|
183
|
+
CERTIFICATE = (
|
|
184
|
+
"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/certificate"
|
|
185
|
+
)
|
|
186
|
+
CHART = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
|
|
187
|
+
CHARTSHEET = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet"
|
|
188
|
+
CHART_USER_SHAPES = (
|
|
189
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes"
|
|
190
|
+
)
|
|
191
|
+
COMMENTS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
|
|
192
|
+
COMMENT_AUTHORS = (
|
|
193
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"
|
|
194
|
+
)
|
|
195
|
+
CONNECTIONS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections"
|
|
196
|
+
CONTROL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"
|
|
197
|
+
CORE_PROPERTIES = (
|
|
198
|
+
"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
|
|
199
|
+
)
|
|
200
|
+
CUSTOM_PROPERTIES = (
|
|
201
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
|
|
202
|
+
)
|
|
203
|
+
CUSTOM_PROPERTY = (
|
|
204
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customProperty"
|
|
205
|
+
)
|
|
206
|
+
CUSTOM_XML = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"
|
|
207
|
+
CUSTOM_XML_PROPS = (
|
|
208
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"
|
|
209
|
+
)
|
|
210
|
+
DIAGRAM_COLORS = (
|
|
211
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors"
|
|
212
|
+
)
|
|
213
|
+
DIAGRAM_DATA = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"
|
|
214
|
+
DIAGRAM_LAYOUT = (
|
|
215
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"
|
|
216
|
+
)
|
|
217
|
+
DIAGRAM_QUICK_STYLE = (
|
|
218
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"
|
|
219
|
+
)
|
|
220
|
+
DIALOGSHEET = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet"
|
|
221
|
+
DRAWING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
|
|
222
|
+
ENDNOTES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"
|
|
223
|
+
EXTENDED_PROPERTIES = (
|
|
224
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
|
|
225
|
+
)
|
|
226
|
+
EXTERNAL_LINK = (
|
|
227
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink"
|
|
228
|
+
)
|
|
229
|
+
FONT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font"
|
|
230
|
+
FONT_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"
|
|
231
|
+
FOOTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
|
|
232
|
+
FOOTNOTES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"
|
|
233
|
+
GLOSSARY_DOCUMENT = (
|
|
234
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"
|
|
235
|
+
)
|
|
236
|
+
HANDOUT_MASTER = (
|
|
237
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster"
|
|
238
|
+
)
|
|
239
|
+
HEADER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"
|
|
240
|
+
HYPERLINK = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
|
|
241
|
+
IMAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
|
|
242
|
+
NOTES_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"
|
|
243
|
+
NOTES_SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"
|
|
244
|
+
NUMBERING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"
|
|
245
|
+
OFFICE_DOCUMENT = (
|
|
246
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
|
|
247
|
+
)
|
|
248
|
+
OLE_OBJECT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
|
|
249
|
+
ORIGIN = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
|
|
250
|
+
PACKAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
|
|
251
|
+
PIVOT_CACHE_DEFINITION = (
|
|
252
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"
|
|
253
|
+
)
|
|
254
|
+
PIVOT_CACHE_RECORDS = (
|
|
255
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
256
|
+
"/spreadsheetml/pivotCacheRecords"
|
|
257
|
+
)
|
|
258
|
+
PIVOT_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"
|
|
259
|
+
PRES_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"
|
|
260
|
+
PRINTER_SETTINGS = (
|
|
261
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings"
|
|
262
|
+
)
|
|
263
|
+
QUERY_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable"
|
|
264
|
+
REVISION_HEADERS = (
|
|
265
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders"
|
|
266
|
+
)
|
|
267
|
+
REVISION_LOG = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog"
|
|
268
|
+
SETTINGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"
|
|
269
|
+
SHARED_STRINGS = (
|
|
270
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"
|
|
271
|
+
)
|
|
272
|
+
SHEET_METADATA = (
|
|
273
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata"
|
|
274
|
+
)
|
|
275
|
+
SIGNATURE = (
|
|
276
|
+
"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature"
|
|
277
|
+
)
|
|
278
|
+
SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
|
|
279
|
+
SLIDE_LAYOUT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"
|
|
280
|
+
SLIDE_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"
|
|
281
|
+
SLIDE_UPDATE_INFO = (
|
|
282
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideUpdateInfo"
|
|
283
|
+
)
|
|
284
|
+
STYLES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
|
|
285
|
+
TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
|
|
286
|
+
TABLE_SINGLE_CELLS = (
|
|
287
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells"
|
|
288
|
+
)
|
|
289
|
+
TABLE_STYLES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"
|
|
290
|
+
TAGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tags"
|
|
291
|
+
THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
|
|
292
|
+
THEME_OVERRIDE = (
|
|
293
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride"
|
|
294
|
+
)
|
|
295
|
+
THUMBNAIL = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"
|
|
296
|
+
USERNAMES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/usernames"
|
|
297
|
+
VIDEO = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"
|
|
298
|
+
VIEW_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps"
|
|
299
|
+
VML_DRAWING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
|
|
300
|
+
VOLATILE_DEPENDENCIES = (
|
|
301
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/volatileDependencies"
|
|
302
|
+
)
|
|
303
|
+
WEB_SETTINGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"
|
|
304
|
+
WORKSHEET_SOURCE = (
|
|
305
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheetSource"
|
|
306
|
+
)
|
|
307
|
+
XML_MAPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/xmlMaps"
|
docx/opc/coreprops.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""Provides CoreProperties, Dublin-Core attributes of the document.
|
|
2
|
+
|
|
3
|
+
These are broadly-standardized attributes like author, last-modified, etc.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import datetime as dt
|
|
9
|
+
from typing import TYPE_CHECKING
|
|
10
|
+
|
|
11
|
+
from docx.oxml.coreprops import CT_CoreProperties
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from docx.oxml.coreprops import CT_CoreProperties
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CoreProperties:
|
|
18
|
+
"""Corresponds to part named ``/docProps/core.xml``, containing the core document
|
|
19
|
+
properties for this document package."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, element: CT_CoreProperties):
|
|
22
|
+
self._element = element
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def author(self):
|
|
26
|
+
return self._element.author_text
|
|
27
|
+
|
|
28
|
+
@author.setter
|
|
29
|
+
def author(self, value: str):
|
|
30
|
+
self._element.author_text = value
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def category(self):
|
|
34
|
+
return self._element.category_text
|
|
35
|
+
|
|
36
|
+
@category.setter
|
|
37
|
+
def category(self, value: str):
|
|
38
|
+
self._element.category_text = value
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def comments(self):
|
|
42
|
+
return self._element.comments_text
|
|
43
|
+
|
|
44
|
+
@comments.setter
|
|
45
|
+
def comments(self, value: str):
|
|
46
|
+
self._element.comments_text = value
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def content_status(self):
|
|
50
|
+
return self._element.contentStatus_text
|
|
51
|
+
|
|
52
|
+
@content_status.setter
|
|
53
|
+
def content_status(self, value: str):
|
|
54
|
+
self._element.contentStatus_text = value
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def created(self):
|
|
58
|
+
return self._element.created_datetime
|
|
59
|
+
|
|
60
|
+
@created.setter
|
|
61
|
+
def created(self, value: dt.datetime):
|
|
62
|
+
self._element.created_datetime = value
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def identifier(self):
|
|
66
|
+
return self._element.identifier_text
|
|
67
|
+
|
|
68
|
+
@identifier.setter
|
|
69
|
+
def identifier(self, value: str):
|
|
70
|
+
self._element.identifier_text = value
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def keywords(self):
|
|
74
|
+
return self._element.keywords_text
|
|
75
|
+
|
|
76
|
+
@keywords.setter
|
|
77
|
+
def keywords(self, value: str):
|
|
78
|
+
self._element.keywords_text = value
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def language(self):
|
|
82
|
+
return self._element.language_text
|
|
83
|
+
|
|
84
|
+
@language.setter
|
|
85
|
+
def language(self, value: str):
|
|
86
|
+
self._element.language_text = value
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def last_modified_by(self):
|
|
90
|
+
return self._element.lastModifiedBy_text
|
|
91
|
+
|
|
92
|
+
@last_modified_by.setter
|
|
93
|
+
def last_modified_by(self, value: str):
|
|
94
|
+
self._element.lastModifiedBy_text = value
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def last_printed(self):
|
|
98
|
+
return self._element.lastPrinted_datetime
|
|
99
|
+
|
|
100
|
+
@last_printed.setter
|
|
101
|
+
def last_printed(self, value: dt.datetime):
|
|
102
|
+
self._element.lastPrinted_datetime = value
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def modified(self):
|
|
106
|
+
return self._element.modified_datetime
|
|
107
|
+
|
|
108
|
+
@modified.setter
|
|
109
|
+
def modified(self, value: dt.datetime):
|
|
110
|
+
self._element.modified_datetime = value
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def revision(self):
|
|
114
|
+
return self._element.revision_number
|
|
115
|
+
|
|
116
|
+
@revision.setter
|
|
117
|
+
def revision(self, value: int):
|
|
118
|
+
self._element.revision_number = value
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def subject(self):
|
|
122
|
+
return self._element.subject_text
|
|
123
|
+
|
|
124
|
+
@subject.setter
|
|
125
|
+
def subject(self, value: str):
|
|
126
|
+
self._element.subject_text = value
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def title(self):
|
|
130
|
+
return self._element.title_text
|
|
131
|
+
|
|
132
|
+
@title.setter
|
|
133
|
+
def title(self, value: str):
|
|
134
|
+
self._element.title_text = value
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def version(self):
|
|
138
|
+
return self._element.version_text
|
|
139
|
+
|
|
140
|
+
@version.setter
|
|
141
|
+
def version(self, value: str):
|
|
142
|
+
self._element.version_text = value
|
docx/opc/customprops.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import numbers
|
|
2
|
+
|
|
3
|
+
from lxml import etree
|
|
4
|
+
|
|
5
|
+
NS_VT = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CustomProperties:
|
|
9
|
+
"""
|
|
10
|
+
Corresponds to part named ``/docProps/custom.xml``, containing the custom
|
|
11
|
+
document properties for this document package.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, element):
|
|
15
|
+
self._element = element
|
|
16
|
+
|
|
17
|
+
def __getitem__(self, item):
|
|
18
|
+
prop = self.lookup(item)
|
|
19
|
+
if prop is not None:
|
|
20
|
+
elm = prop[0]
|
|
21
|
+
if elm.tag == "{%s}i4" % NS_VT:
|
|
22
|
+
try:
|
|
23
|
+
return int(elm.text)
|
|
24
|
+
except ValueError:
|
|
25
|
+
return elm.text
|
|
26
|
+
elif elm.tag == "{%s}bool" % NS_VT:
|
|
27
|
+
return elm.text.lower() in ["1", "true"]
|
|
28
|
+
return elm.text
|
|
29
|
+
|
|
30
|
+
def __setitem__(self, key, value):
|
|
31
|
+
prop = self.lookup(key)
|
|
32
|
+
if prop is None:
|
|
33
|
+
elmType = "lpwstr"
|
|
34
|
+
if isinstance(value, bool):
|
|
35
|
+
elmType = "bool"
|
|
36
|
+
value = 'true' if value else 'false'
|
|
37
|
+
elif isinstance(value, numbers.Number):
|
|
38
|
+
elmType = "i4"
|
|
39
|
+
value = str(int(value))
|
|
40
|
+
prop = etree.SubElement(self._element, "property")
|
|
41
|
+
elm = etree.SubElement(prop, "{%s}%s" % (NS_VT, elmType), nsmap={"vt": NS_VT})
|
|
42
|
+
elm.text = value
|
|
43
|
+
prop.set("name", key)
|
|
44
|
+
prop.set("fmtid", "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
|
|
45
|
+
prop.set("pid", f"{str(len(self._element) + 1)}")
|
|
46
|
+
else:
|
|
47
|
+
elm = prop[0]
|
|
48
|
+
if elm.tag == "{%s}i4" % NS_VT:
|
|
49
|
+
elm.text = str(int(value))
|
|
50
|
+
elif elm.tag == "{%s}bool" % NS_VT:
|
|
51
|
+
elm.text = 'true' if value else 'false'
|
|
52
|
+
else:
|
|
53
|
+
elm.text = f"{str(value)}"
|
|
54
|
+
|
|
55
|
+
def __len__(self):
|
|
56
|
+
return len(self._element)
|
|
57
|
+
|
|
58
|
+
def lookup(self, item):
|
|
59
|
+
return next((child for child in self._element if child.get("name") == item), None)
|
docx/opc/exceptions.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Exceptions specific to python-opc.
|
|
2
|
+
|
|
3
|
+
The base exception class is OpcError.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class OpcError(Exception):
|
|
8
|
+
"""Base error class for python-opc."""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PackageNotFoundError(OpcError):
|
|
12
|
+
"""Raised when a package cannot be found at the specified path."""
|