openpyxl.packaging.relationship module¶
-
class
openpyxl.packaging.relationship.Relationship(Id=None, Type=None, type=None, Target=None, TargetMode=None)[源代码]¶ 基类:
openpyxl.descriptors.serialisable.SerialisableRepresents many kinds of relationships.
-
Id¶ Values must be of type <class ‘str’>
-
Target¶ Values must be of type <class ‘str’>
-
TargetMode¶ Values must be of type <class ‘str’>
-
Type¶ Values must be of type <class ‘str’>
-
id¶ Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptve name is desired (eg. “underline” for “u”)
-
tagname= 'Relationship'¶
-
target¶ Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptve name is desired (eg. “underline” for “u”)
-
-
class
openpyxl.packaging.relationship.RelationshipList(Relationship=())[源代码]¶ 基类:
openpyxl.descriptors.serialisable.Serialisable-
Relationship¶ A sequence (list or tuple) that may only contain objects of the declared type
-
find(content_type)[源代码]¶ Find relationships by content-type NB. these content-types namespaced objects and different to the MIME-types in the package manifest :-(
-
tagname= 'Relationships'¶
-
-
openpyxl.packaging.relationship.get_dependents(archive, filename)[源代码]¶ Normalise dependency file paths to absolute ones
Relative paths are relative to parent object
-
openpyxl.packaging.relationship.get_rel(archive, deps, id=None, cls=None)[源代码]¶ Get related object based on id or rel_type
-
openpyxl.packaging.relationship.get_rels_path(path)[源代码]¶ Convert relative path to absolutes that can be loaded from a zip archive. The path to be passed in is that of containing object (workbook, worksheet, etc.)
-
openpyxl.packaging.relationship.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.