openpyxl.packaging.manifest module

File manifest

class openpyxl.packaging.manifest.FileExtension(Extension, ContentType)[源代码]

基类:openpyxl.descriptors.serialisable.Serialisable

ContentType

Values must be of type <class ‘str’>

Extension

Values must be of type <class ‘str’>

tagname = 'Default'
class openpyxl.packaging.manifest.Manifest(Default=(), Override=())[源代码]

基类:openpyxl.descriptors.serialisable.Serialisable

Default

A sequence (list or tuple) that may only contain objects of the declared type

Override

A sequence (list or tuple) that may only contain objects of the declared type

append(obj)[源代码]

Add content object to the package manifest # needs a contract…

extensions

Map content types to file extensions Skip parts without extensions

filenames
find(content_type)[源代码]

Find specific content-type

findall(content_type)[源代码]

Find all elements of a specific content-type

path = '[Content_Types].xml'
tagname = 'Types'
to_tree()[源代码]

Custom serialisation method to allow setting a default namespace

class openpyxl.packaging.manifest.Override(PartName, ContentType)[源代码]

基类:openpyxl.descriptors.serialisable.Serialisable

ContentType

Values must be of type <class ‘str’>

PartName

Values must be of type <class ‘str’>

tagname = 'Override'
openpyxl.packaging.manifest.tostring(element, *, encoding='utf-8', method=None, short_empty_elements=True)

Generate string representation of XML element.

All subelements are included. If encoding is “unicode”, a string is returned. Otherwise a bytestring is returned.

element is an Element instance, encoding is an optional output encoding defaulting to US-ASCII, method is an optional output which can be one of “xml” (default), “html”, “text” or “c14n”.

Returns an (optionally) encoded string containing the XML data.