A Part of a Document.
A Part of a Document.
Variables: |
|
---|
Determine Content Type of this Part by parsing [Content_Types].xml
For information about how Content Types are stored, see: http://office.microsoft.com/en-us/office-open-xml-i-exploring-the-office-open-xml-formats-RZ010243529.aspx?section=16
Returns: | the Content Type of this Part |
---|
Determine all Relationship objects for which this part is the target.
>>> doc.part_by_name['/word/document.xml'].relationships_in()[0].target
'word/document.xml'
Returns: | list of all Relationships in |
---|
Determine all Relationship objects for which this part is the source.
>>> for rel in doc.part_by_name['/word/document.xml'].relationships_out():
>>> print rel.source
Part [/word/document.xml]
Part [/word/document.xml]
Part [/word/document.xml]
Returns: | list of all Relationships out |
---|
Export this object to JSON
Parameters: | include_stream (bool) – Optional - Include base64 encoded stream of this Part (Default false). |
---|---|
Returns: | a JSON encoded string |
A which uniquely identifies this object.
Returns: | string which uniquely identifies this object |
---|
Evaluate the XPath expression ‘exp’ on the XML of the Part.
To properly understand how to use xpath, see the documentation of XML Namespaces.
The suggested method to use xpath is to provide a user-defined namespace mapping. For example:
>>> CP_NAMESPACE = {'cp': "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
>>> 'dc': "http://purl.org/dc/elements/1.1/",
>>> 'dcterms': "http://purl.org/dc/terms/",
>>> 'dcmitype': "http://purl.org/dc/dcmitype/",
>>> 'xsi': "http://www.w3.org/2001/XMLSchema-instance"}
>>> result = part.xpath('/cp:coreProperties/dcterms:created', CP_NAMESPACE)
>>> result[0].text
'2008-11-03T19:31:00Z'
Parameters: |
|
---|---|
Returns: | the result of the XPATH query. |