PackURI
paper-docx 0.2.0 API reference
Provides access to pack URI components such as the baseURI and the filename slice.
Behaves as str otherwise.
Attributes
baseURI
attributebaseURIstrThe base URI of this pack URI, the directory portion, roughly speaking.
E.g. '/ppt/slides' for '/ppt/slides/slide1.xml'. For the package pseudo-
partname '/', baseURI is '/'.
ext
attributeextstrThe extension portion of this pack URI, e.g. 'xml' for '/word/document.xml'.
Note the period is not included.
filename
attributefilenameThe "filename" portion of this pack URI, e.g. 'slide1.xml' for
'/ppt/slides/slide1.xml'.
For the package pseudo-partname '/', filename is ''.
idx
attributeidxReturn partname index as integer for tuple partname or None for singleton
partname, e.g. 21 for '/ppt/slides/slide21.xml' and None for
'/ppt/presentation.xml'.
membername
attributemembernameThe pack URI with the leading slash stripped off, the form used as the Zip file membername for the package item.
Returns '' for the package pseudo-partname '/'.
rels_uri
attributerels_uriThe pack URI of the .rels part corresponding to the current pack URI.
Only produces sensible output if the pack URI is a partname or the package pseudo-partname '/'.
Functions
from_rel_ref
funcfrom_rel_ref(baseURI: str, relative_ref: str) -> PackURIThe absolute PackURI formed by translating relative_ref onto baseURI.
parambaseURIstrparamrelative_refstrReturns
docx.opc.packuri.PackURIrelative_ref
funcrelative_ref(baseURI: str)Return string containing relative reference to package item from baseURI.
E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would return '../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'.
parambaseURIstr