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/image/tiff.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
from .constants import MIME_TYPE, TIFF_FLD, TIFF_TAG
|
|
2
|
+
from .helpers import BIG_ENDIAN, LITTLE_ENDIAN, StreamReader
|
|
3
|
+
from .image import BaseImageHeader
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Tiff(BaseImageHeader):
|
|
7
|
+
"""Image header parser for TIFF images.
|
|
8
|
+
|
|
9
|
+
Handles both big and little endian byte ordering.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def content_type(self):
|
|
14
|
+
"""Return the MIME type of this TIFF image, unconditionally the string
|
|
15
|
+
``image/tiff``."""
|
|
16
|
+
return MIME_TYPE.TIFF
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def default_ext(self):
|
|
20
|
+
"""Default filename extension, always 'tiff' for TIFF images."""
|
|
21
|
+
return "tiff"
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_stream(cls, stream):
|
|
25
|
+
"""Return a |Tiff| instance containing the properties of the TIFF image in
|
|
26
|
+
`stream`."""
|
|
27
|
+
parser = _TiffParser.parse(stream)
|
|
28
|
+
|
|
29
|
+
px_width = parser.px_width
|
|
30
|
+
px_height = parser.px_height
|
|
31
|
+
horz_dpi = parser.horz_dpi
|
|
32
|
+
vert_dpi = parser.vert_dpi
|
|
33
|
+
|
|
34
|
+
return cls(px_width, px_height, horz_dpi, vert_dpi)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class _TiffParser:
|
|
38
|
+
"""Parses a TIFF image stream to extract the image properties found in its main
|
|
39
|
+
image file directory (IFD)"""
|
|
40
|
+
|
|
41
|
+
def __init__(self, ifd_entries):
|
|
42
|
+
super(_TiffParser, self).__init__()
|
|
43
|
+
self._ifd_entries = ifd_entries
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def parse(cls, stream):
|
|
47
|
+
"""Return an instance of |_TiffParser| containing the properties parsed from the
|
|
48
|
+
TIFF image in `stream`."""
|
|
49
|
+
stream_rdr = cls._make_stream_reader(stream)
|
|
50
|
+
ifd0_offset = stream_rdr.read_long(4)
|
|
51
|
+
ifd_entries = _IfdEntries.from_stream(stream_rdr, ifd0_offset)
|
|
52
|
+
return cls(ifd_entries)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def horz_dpi(self):
|
|
56
|
+
"""The horizontal dots per inch value calculated from the XResolution and
|
|
57
|
+
ResolutionUnit tags of the IFD; defaults to 72 if those tags are not present."""
|
|
58
|
+
return self._dpi(TIFF_TAG.X_RESOLUTION)
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def vert_dpi(self):
|
|
62
|
+
"""The vertical dots per inch value calculated from the XResolution and
|
|
63
|
+
ResolutionUnit tags of the IFD; defaults to 72 if those tags are not present."""
|
|
64
|
+
return self._dpi(TIFF_TAG.Y_RESOLUTION)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def px_height(self):
|
|
68
|
+
"""The number of stacked rows of pixels in the image, |None| if the IFD contains
|
|
69
|
+
no ``ImageLength`` tag, the expected case when the TIFF is embeded in an Exif
|
|
70
|
+
image."""
|
|
71
|
+
return self._ifd_entries.get(TIFF_TAG.IMAGE_LENGTH)
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def px_width(self):
|
|
75
|
+
"""The number of pixels in each row in the image, |None| if the IFD contains no
|
|
76
|
+
``ImageWidth`` tag, the expected case when the TIFF is embeded in an Exif
|
|
77
|
+
image."""
|
|
78
|
+
return self._ifd_entries.get(TIFF_TAG.IMAGE_WIDTH)
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def _detect_endian(cls, stream):
|
|
82
|
+
"""Return either BIG_ENDIAN or LITTLE_ENDIAN depending on the endian indicator
|
|
83
|
+
found in the TIFF `stream` header, either 'MM' or 'II'."""
|
|
84
|
+
stream.seek(0)
|
|
85
|
+
endian_str = stream.read(2)
|
|
86
|
+
return BIG_ENDIAN if endian_str == b"MM" else LITTLE_ENDIAN
|
|
87
|
+
|
|
88
|
+
def _dpi(self, resolution_tag):
|
|
89
|
+
"""Return the dpi value calculated for `resolution_tag`, which can be either
|
|
90
|
+
TIFF_TAG.X_RESOLUTION or TIFF_TAG.Y_RESOLUTION.
|
|
91
|
+
|
|
92
|
+
The calculation is based on the values of both that tag and the
|
|
93
|
+
TIFF_TAG.RESOLUTION_UNIT tag in this parser's |_IfdEntries| instance.
|
|
94
|
+
"""
|
|
95
|
+
ifd_entries = self._ifd_entries
|
|
96
|
+
|
|
97
|
+
if resolution_tag not in ifd_entries:
|
|
98
|
+
return 72
|
|
99
|
+
|
|
100
|
+
# resolution unit defaults to inches (2)
|
|
101
|
+
resolution_unit = ifd_entries.get(TIFF_TAG.RESOLUTION_UNIT, 2)
|
|
102
|
+
|
|
103
|
+
if resolution_unit == 1: # aspect ratio only
|
|
104
|
+
return 72
|
|
105
|
+
# resolution_unit == 2 for inches, 3 for centimeters
|
|
106
|
+
units_per_inch = 1 if resolution_unit == 2 else 2.54
|
|
107
|
+
dots_per_unit = ifd_entries[resolution_tag]
|
|
108
|
+
return int(round(dots_per_unit * units_per_inch))
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def _make_stream_reader(cls, stream):
|
|
112
|
+
"""Return a |StreamReader| instance with wrapping `stream` and having "endian-
|
|
113
|
+
ness" determined by the 'MM' or 'II' indicator in the TIFF stream header."""
|
|
114
|
+
endian = cls._detect_endian(stream)
|
|
115
|
+
return StreamReader(stream, endian)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class _IfdEntries:
|
|
119
|
+
"""Image File Directory for a TIFF image, having mapping (dict) semantics allowing
|
|
120
|
+
"tag" values to be retrieved by tag code."""
|
|
121
|
+
|
|
122
|
+
def __init__(self, entries):
|
|
123
|
+
super(_IfdEntries, self).__init__()
|
|
124
|
+
self._entries = entries
|
|
125
|
+
|
|
126
|
+
def __contains__(self, key):
|
|
127
|
+
"""Provides ``in`` operator, e.g. ``tag in ifd_entries``"""
|
|
128
|
+
return self._entries.__contains__(key)
|
|
129
|
+
|
|
130
|
+
def __getitem__(self, key):
|
|
131
|
+
"""Provides indexed access, e.g. ``tag_value = ifd_entries[tag_code]``"""
|
|
132
|
+
return self._entries.__getitem__(key)
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_stream(cls, stream, offset):
|
|
136
|
+
"""Return a new |_IfdEntries| instance parsed from `stream` starting at
|
|
137
|
+
`offset`."""
|
|
138
|
+
ifd_parser = _IfdParser(stream, offset)
|
|
139
|
+
entries = {e.tag: e.value for e in ifd_parser.iter_entries()}
|
|
140
|
+
return cls(entries)
|
|
141
|
+
|
|
142
|
+
def get(self, tag_code, default=None):
|
|
143
|
+
"""Return value of IFD entry having tag matching `tag_code`, or `default` if no
|
|
144
|
+
matching tag found."""
|
|
145
|
+
return self._entries.get(tag_code, default)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class _IfdParser:
|
|
149
|
+
"""Service object that knows how to extract directory entries from an Image File
|
|
150
|
+
Directory (IFD)"""
|
|
151
|
+
|
|
152
|
+
def __init__(self, stream_rdr, offset):
|
|
153
|
+
super(_IfdParser, self).__init__()
|
|
154
|
+
self._stream_rdr = stream_rdr
|
|
155
|
+
self._offset = offset
|
|
156
|
+
|
|
157
|
+
def iter_entries(self):
|
|
158
|
+
"""Generate an |_IfdEntry| instance corresponding to each entry in the
|
|
159
|
+
directory."""
|
|
160
|
+
for idx in range(self._entry_count):
|
|
161
|
+
dir_entry_offset = self._offset + 2 + (idx * 12)
|
|
162
|
+
ifd_entry = _IfdEntryFactory(self._stream_rdr, dir_entry_offset)
|
|
163
|
+
yield ifd_entry
|
|
164
|
+
|
|
165
|
+
@property
|
|
166
|
+
def _entry_count(self):
|
|
167
|
+
"""The count of directory entries, read from the top of the IFD header."""
|
|
168
|
+
return self._stream_rdr.read_short(self._offset)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def _IfdEntryFactory(stream_rdr, offset):
|
|
172
|
+
"""Return an |_IfdEntry| subclass instance containing the value of the directory
|
|
173
|
+
entry at `offset` in `stream_rdr`."""
|
|
174
|
+
ifd_entry_classes = {
|
|
175
|
+
TIFF_FLD.ASCII: _AsciiIfdEntry,
|
|
176
|
+
TIFF_FLD.SHORT: _ShortIfdEntry,
|
|
177
|
+
TIFF_FLD.LONG: _LongIfdEntry,
|
|
178
|
+
TIFF_FLD.RATIONAL: _RationalIfdEntry,
|
|
179
|
+
}
|
|
180
|
+
field_type = stream_rdr.read_short(offset, 2)
|
|
181
|
+
EntryCls = ifd_entry_classes.get(field_type, _IfdEntry)
|
|
182
|
+
return EntryCls.from_stream(stream_rdr, offset)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class _IfdEntry:
|
|
186
|
+
"""Base class for IFD entry classes.
|
|
187
|
+
|
|
188
|
+
Subclasses are differentiated by value type, e.g. ASCII, long int, etc.
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
def __init__(self, tag_code, value):
|
|
192
|
+
super(_IfdEntry, self).__init__()
|
|
193
|
+
self._tag_code = tag_code
|
|
194
|
+
self._value = value
|
|
195
|
+
|
|
196
|
+
@classmethod
|
|
197
|
+
def from_stream(cls, stream_rdr, offset):
|
|
198
|
+
"""Return an |_IfdEntry| subclass instance containing the tag and value of the
|
|
199
|
+
tag parsed from `stream_rdr` at `offset`.
|
|
200
|
+
|
|
201
|
+
Note this method is common to all subclasses. Override the ``_parse_value()``
|
|
202
|
+
method to provide distinctive behavior based on field type.
|
|
203
|
+
"""
|
|
204
|
+
tag_code = stream_rdr.read_short(offset, 0)
|
|
205
|
+
value_count = stream_rdr.read_long(offset, 4)
|
|
206
|
+
value_offset = stream_rdr.read_long(offset, 8)
|
|
207
|
+
value = cls._parse_value(stream_rdr, offset, value_count, value_offset)
|
|
208
|
+
return cls(tag_code, value)
|
|
209
|
+
|
|
210
|
+
@classmethod
|
|
211
|
+
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
|
|
212
|
+
"""Return the value of this field parsed from `stream_rdr` at `offset`.
|
|
213
|
+
|
|
214
|
+
Intended to be overridden by subclasses.
|
|
215
|
+
"""
|
|
216
|
+
return "UNIMPLEMENTED FIELD TYPE" # pragma: no cover
|
|
217
|
+
|
|
218
|
+
@property
|
|
219
|
+
def tag(self):
|
|
220
|
+
"""Short int code that identifies this IFD entry."""
|
|
221
|
+
return self._tag_code
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
def value(self):
|
|
225
|
+
"""Value of this tag, its type being dependent on the tag."""
|
|
226
|
+
return self._value
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class _AsciiIfdEntry(_IfdEntry):
|
|
230
|
+
"""IFD entry having the form of a NULL-terminated ASCII string."""
|
|
231
|
+
|
|
232
|
+
@classmethod
|
|
233
|
+
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
|
|
234
|
+
"""Return the ASCII string parsed from `stream_rdr` at `value_offset`.
|
|
235
|
+
|
|
236
|
+
The length of the string, including a terminating '\x00' (NUL) character, is in
|
|
237
|
+
`value_count`.
|
|
238
|
+
"""
|
|
239
|
+
return stream_rdr.read_str(value_count - 1, value_offset)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class _ShortIfdEntry(_IfdEntry):
|
|
243
|
+
"""IFD entry expressed as a short (2-byte) integer."""
|
|
244
|
+
|
|
245
|
+
@classmethod
|
|
246
|
+
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
|
|
247
|
+
"""Return the short int value contained in the `value_offset` field of this
|
|
248
|
+
entry.
|
|
249
|
+
|
|
250
|
+
Only supports single values at present.
|
|
251
|
+
"""
|
|
252
|
+
if value_count == 1:
|
|
253
|
+
return stream_rdr.read_short(offset, 8)
|
|
254
|
+
else: # pragma: no cover
|
|
255
|
+
return "Multi-value short integer NOT IMPLEMENTED"
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class _LongIfdEntry(_IfdEntry):
|
|
259
|
+
"""IFD entry expressed as a long (4-byte) integer."""
|
|
260
|
+
|
|
261
|
+
@classmethod
|
|
262
|
+
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
|
|
263
|
+
"""Return the long int value contained in the `value_offset` field of this
|
|
264
|
+
entry.
|
|
265
|
+
|
|
266
|
+
Only supports single values at present.
|
|
267
|
+
"""
|
|
268
|
+
if value_count == 1:
|
|
269
|
+
return stream_rdr.read_long(offset, 8)
|
|
270
|
+
else: # pragma: no cover
|
|
271
|
+
return "Multi-value long integer NOT IMPLEMENTED"
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class _RationalIfdEntry(_IfdEntry):
|
|
275
|
+
"""IFD entry expressed as a numerator, denominator pair."""
|
|
276
|
+
|
|
277
|
+
@classmethod
|
|
278
|
+
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
|
|
279
|
+
"""Return the rational (numerator / denominator) value at `value_offset` in
|
|
280
|
+
`stream_rdr` as a floating-point number.
|
|
281
|
+
|
|
282
|
+
Only supports single values at present.
|
|
283
|
+
"""
|
|
284
|
+
if value_count == 1:
|
|
285
|
+
numerator = stream_rdr.read_long(value_offset)
|
|
286
|
+
denominator = stream_rdr.read_long(value_offset, 4)
|
|
287
|
+
return numerator / denominator
|
|
288
|
+
else: # pragma: no cover
|
|
289
|
+
return "Multi-value Rational NOT IMPLEMENTED"
|
docx/opc/__init__.py
ADDED
|
File without changes
|
docx/opc/constants.py
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
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_DIGITAL_SIGNATURE_CERTIFICATE = (
|
|
35
|
+
"application/vnd.openxmlformats-package.digital-signature-certificate"
|
|
36
|
+
)
|
|
37
|
+
OPC_DIGITAL_SIGNATURE_ORIGIN = "application/vnd.openxmlformats-package.digital-signature-origin"
|
|
38
|
+
OPC_DIGITAL_SIGNATURE_XMLSIGNATURE = (
|
|
39
|
+
"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml"
|
|
40
|
+
)
|
|
41
|
+
OPC_RELATIONSHIPS = "application/vnd.openxmlformats-package.relationships+xml"
|
|
42
|
+
PML_COMMENTS = "application/vnd.openxmlformats-officedocument.presentationml.comments+xml"
|
|
43
|
+
PML_COMMENT_AUTHORS = (
|
|
44
|
+
"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml"
|
|
45
|
+
)
|
|
46
|
+
PML_HANDOUT_MASTER = (
|
|
47
|
+
"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml"
|
|
48
|
+
)
|
|
49
|
+
PML_NOTES_MASTER = (
|
|
50
|
+
"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"
|
|
51
|
+
)
|
|
52
|
+
PML_NOTES_SLIDE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"
|
|
53
|
+
PML_PRESENTATION_MAIN = (
|
|
54
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
|
|
55
|
+
)
|
|
56
|
+
PML_PRES_PROPS = "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"
|
|
57
|
+
PML_PRINTER_SETTINGS = (
|
|
58
|
+
"application/vnd.openxmlformats-officedocument.presentationml.printerSettings"
|
|
59
|
+
)
|
|
60
|
+
PML_SLIDE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml"
|
|
61
|
+
PML_SLIDESHOW_MAIN = (
|
|
62
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"
|
|
63
|
+
)
|
|
64
|
+
PML_SLIDE_LAYOUT = (
|
|
65
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"
|
|
66
|
+
)
|
|
67
|
+
PML_SLIDE_MASTER = (
|
|
68
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"
|
|
69
|
+
)
|
|
70
|
+
PML_SLIDE_UPDATE_INFO = (
|
|
71
|
+
"application/vnd.openxmlformats-officedocument.presentationml.slideUpdateInfo+xml"
|
|
72
|
+
)
|
|
73
|
+
PML_TABLE_STYLES = (
|
|
74
|
+
"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"
|
|
75
|
+
)
|
|
76
|
+
PML_TAGS = "application/vnd.openxmlformats-officedocument.presentationml.tags+xml"
|
|
77
|
+
PML_TEMPLATE_MAIN = (
|
|
78
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml"
|
|
79
|
+
)
|
|
80
|
+
PML_VIEW_PROPS = "application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"
|
|
81
|
+
PNG = "image/png"
|
|
82
|
+
SML_CALC_CHAIN = "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml"
|
|
83
|
+
SML_CHARTSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml"
|
|
84
|
+
SML_COMMENTS = "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"
|
|
85
|
+
SML_CONNECTIONS = "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"
|
|
86
|
+
SML_CUSTOM_PROPERTY = (
|
|
87
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty"
|
|
88
|
+
)
|
|
89
|
+
SML_DIALOGSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml"
|
|
90
|
+
SML_EXTERNAL_LINK = (
|
|
91
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
92
|
+
)
|
|
93
|
+
SML_PIVOT_CACHE_DEFINITION = (
|
|
94
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml"
|
|
95
|
+
)
|
|
96
|
+
SML_PIVOT_CACHE_RECORDS = (
|
|
97
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"
|
|
98
|
+
)
|
|
99
|
+
SML_PIVOT_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"
|
|
100
|
+
SML_PRINTER_SETTINGS = (
|
|
101
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings"
|
|
102
|
+
)
|
|
103
|
+
SML_QUERY_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml"
|
|
104
|
+
SML_REVISION_HEADERS = (
|
|
105
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml"
|
|
106
|
+
)
|
|
107
|
+
SML_REVISION_LOG = "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml"
|
|
108
|
+
SML_SHARED_STRINGS = (
|
|
109
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
|
|
110
|
+
)
|
|
111
|
+
SML_SHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
112
|
+
SML_SHEET_MAIN = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
|
|
113
|
+
SML_SHEET_METADATA = (
|
|
114
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml"
|
|
115
|
+
)
|
|
116
|
+
SML_STYLES = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
|
|
117
|
+
SML_TABLE = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
|
|
118
|
+
SML_TABLE_SINGLE_CELLS = (
|
|
119
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml"
|
|
120
|
+
)
|
|
121
|
+
SML_TEMPLATE_MAIN = (
|
|
122
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"
|
|
123
|
+
)
|
|
124
|
+
SML_USER_NAMES = "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml"
|
|
125
|
+
SML_VOLATILE_DEPENDENCIES = (
|
|
126
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml"
|
|
127
|
+
)
|
|
128
|
+
SML_WORKSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
|
|
129
|
+
TIFF = "image/tiff"
|
|
130
|
+
WML_COMMENTS = "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"
|
|
131
|
+
WML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
132
|
+
WML_DOCUMENT_GLOSSARY = (
|
|
133
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml"
|
|
134
|
+
)
|
|
135
|
+
WML_DOCUMENT_MAIN = (
|
|
136
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
|
|
137
|
+
)
|
|
138
|
+
WML_ENDNOTES = "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"
|
|
139
|
+
WML_FONT_TABLE = "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"
|
|
140
|
+
WML_FOOTER = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"
|
|
141
|
+
WML_FOOTNOTES = "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"
|
|
142
|
+
WML_HEADER = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"
|
|
143
|
+
WML_NUMBERING = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"
|
|
144
|
+
WML_PRINTER_SETTINGS = (
|
|
145
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.printerSettings"
|
|
146
|
+
)
|
|
147
|
+
WML_SETTINGS = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"
|
|
148
|
+
WML_STYLES = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"
|
|
149
|
+
WML_WEB_SETTINGS = (
|
|
150
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"
|
|
151
|
+
)
|
|
152
|
+
XML = "application/xml"
|
|
153
|
+
X_EMF = "image/x-emf"
|
|
154
|
+
X_FONTDATA = "application/x-fontdata"
|
|
155
|
+
X_FONT_TTF = "application/x-font-ttf"
|
|
156
|
+
X_WMF = "image/x-wmf"
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class NAMESPACE:
|
|
160
|
+
"""Constant values for OPC XML namespaces."""
|
|
161
|
+
|
|
162
|
+
DML_WORDPROCESSING_DRAWING = (
|
|
163
|
+
"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
|
|
164
|
+
)
|
|
165
|
+
OFC_RELATIONSHIPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
166
|
+
OPC_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
167
|
+
OPC_CONTENT_TYPES = "http://schemas.openxmlformats.org/package/2006/content-types"
|
|
168
|
+
WML_MAIN = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class RELATIONSHIP_TARGET_MODE:
|
|
172
|
+
"""Open XML relationship target modes."""
|
|
173
|
+
|
|
174
|
+
EXTERNAL = "External"
|
|
175
|
+
INTERNAL = "Internal"
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class RELATIONSHIP_TYPE:
|
|
179
|
+
AUDIO = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"
|
|
180
|
+
A_F_CHUNK = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"
|
|
181
|
+
CALC_CHAIN = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain"
|
|
182
|
+
CERTIFICATE = (
|
|
183
|
+
"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/certificate"
|
|
184
|
+
)
|
|
185
|
+
CHART = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
|
|
186
|
+
CHARTSHEET = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet"
|
|
187
|
+
CHART_USER_SHAPES = (
|
|
188
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes"
|
|
189
|
+
)
|
|
190
|
+
COMMENTS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
|
|
191
|
+
COMMENT_AUTHORS = (
|
|
192
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"
|
|
193
|
+
)
|
|
194
|
+
CONNECTIONS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections"
|
|
195
|
+
CONTROL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"
|
|
196
|
+
CORE_PROPERTIES = (
|
|
197
|
+
"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
|
|
198
|
+
)
|
|
199
|
+
CUSTOM_PROPERTIES = (
|
|
200
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
|
|
201
|
+
)
|
|
202
|
+
CUSTOM_PROPERTY = (
|
|
203
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customProperty"
|
|
204
|
+
)
|
|
205
|
+
CUSTOM_XML = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"
|
|
206
|
+
CUSTOM_XML_PROPS = (
|
|
207
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"
|
|
208
|
+
)
|
|
209
|
+
DIAGRAM_COLORS = (
|
|
210
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors"
|
|
211
|
+
)
|
|
212
|
+
DIAGRAM_DATA = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"
|
|
213
|
+
DIAGRAM_LAYOUT = (
|
|
214
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"
|
|
215
|
+
)
|
|
216
|
+
DIAGRAM_QUICK_STYLE = (
|
|
217
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"
|
|
218
|
+
)
|
|
219
|
+
DIALOGSHEET = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet"
|
|
220
|
+
DRAWING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
|
|
221
|
+
ENDNOTES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"
|
|
222
|
+
EXTENDED_PROPERTIES = (
|
|
223
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
|
|
224
|
+
)
|
|
225
|
+
EXTERNAL_LINK = (
|
|
226
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink"
|
|
227
|
+
)
|
|
228
|
+
FONT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font"
|
|
229
|
+
FONT_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"
|
|
230
|
+
FOOTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
|
|
231
|
+
FOOTNOTES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"
|
|
232
|
+
GLOSSARY_DOCUMENT = (
|
|
233
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"
|
|
234
|
+
)
|
|
235
|
+
HANDOUT_MASTER = (
|
|
236
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster"
|
|
237
|
+
)
|
|
238
|
+
HEADER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"
|
|
239
|
+
HYPERLINK = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
|
|
240
|
+
IMAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
|
|
241
|
+
NOTES_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"
|
|
242
|
+
NOTES_SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"
|
|
243
|
+
NUMBERING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"
|
|
244
|
+
OFFICE_DOCUMENT = (
|
|
245
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
|
|
246
|
+
)
|
|
247
|
+
OLE_OBJECT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
|
|
248
|
+
ORIGIN = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
|
|
249
|
+
PACKAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
|
|
250
|
+
PIVOT_CACHE_DEFINITION = (
|
|
251
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"
|
|
252
|
+
)
|
|
253
|
+
PIVOT_CACHE_RECORDS = (
|
|
254
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
255
|
+
"/spreadsheetml/pivotCacheRecords"
|
|
256
|
+
)
|
|
257
|
+
PIVOT_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"
|
|
258
|
+
PRES_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"
|
|
259
|
+
PRINTER_SETTINGS = (
|
|
260
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings"
|
|
261
|
+
)
|
|
262
|
+
QUERY_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable"
|
|
263
|
+
REVISION_HEADERS = (
|
|
264
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders"
|
|
265
|
+
)
|
|
266
|
+
REVISION_LOG = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog"
|
|
267
|
+
SETTINGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"
|
|
268
|
+
SHARED_STRINGS = (
|
|
269
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"
|
|
270
|
+
)
|
|
271
|
+
SHEET_METADATA = (
|
|
272
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata"
|
|
273
|
+
)
|
|
274
|
+
SIGNATURE = (
|
|
275
|
+
"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature"
|
|
276
|
+
)
|
|
277
|
+
SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
|
|
278
|
+
SLIDE_LAYOUT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"
|
|
279
|
+
SLIDE_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"
|
|
280
|
+
SLIDE_UPDATE_INFO = (
|
|
281
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideUpdateInfo"
|
|
282
|
+
)
|
|
283
|
+
STYLES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
|
|
284
|
+
TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
|
|
285
|
+
TABLE_SINGLE_CELLS = (
|
|
286
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells"
|
|
287
|
+
)
|
|
288
|
+
TABLE_STYLES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"
|
|
289
|
+
TAGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tags"
|
|
290
|
+
THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
|
|
291
|
+
THEME_OVERRIDE = (
|
|
292
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride"
|
|
293
|
+
)
|
|
294
|
+
THUMBNAIL = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"
|
|
295
|
+
USERNAMES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/usernames"
|
|
296
|
+
VIDEO = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"
|
|
297
|
+
VIEW_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps"
|
|
298
|
+
VML_DRAWING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
|
|
299
|
+
VOLATILE_DEPENDENCIES = (
|
|
300
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/volatileDependencies"
|
|
301
|
+
)
|
|
302
|
+
WEB_SETTINGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"
|
|
303
|
+
WORKSHEET_SOURCE = (
|
|
304
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheetSource"
|
|
305
|
+
)
|
|
306
|
+
XML_MAPS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/xmlMaps"
|