EmbeddedPptxPart
paper-pptx 0.2.0 API reference
A PowerPoint file stored in a part.
This part-type arises when a PowerPoint presentation (.pptx file) appears as an embedded OLE-object shape.
Attributes
blob
attributeblobbytesContents of this package part as a sequence of bytes.
Intended to be overridden by subclasses. Default behavior is to return the blob initial
loaded during Package.open() operation.
content_type
attributecontent_type= CT.PML_PRESENTATIONpackage
attributepackagePackagePackage this part belongs to.
partname
attributepartnamePackURIPackURI partname for this part, e.g. "/ppt/slides/slide1.xml".
partname_template
attributepartname_template= '/ppt/embeddings/Microsoft_PowerPoint_Presentation%d.pptx'rels
attributerels_RelationshipsCollection of relationships from this part to other parts.
Functions
factory
funcfactory(prog_id: PROG_ID | str, object_blob: bytes, package: Package)Return a new EmbeddedPackagePart subclass instance added to package.
The subclass is determined by prog_id which corresponds to the "application"
used to open the "file-type" of object_blob. The returned part contains the
bytes of object_blob and has the content-type also determined by prog_id.
paramprog_idPROG_ID | strparamobject_blobbytesparampackagePackageload
funcload(partname: PackURI, content_type: str, package: Package, blob: bytes) -> SelfReturn cls instance loaded from arguments.
This one is a straight pass-through, but subtypes may do some pre-processing, see XmlPart for an example.
parampartnamePackURIparamcontent_typestrparampackagePackageparamblobbytesReturns
typing_extensions.Selfload_rels_from_xml
funcload_rels_from_xml(xml_rels: CT_Relationships, parts: dict[PackURI, Part]) -> Noneload _Relationships for this part from xml_rels.
Part references are resolved using the parts dict that maps each partname to the loaded
part with that partname. These relationships are loaded from a serialized package and so
already have assigned rIds. This method is only used during package loading.
paramxml_relsCT_Relationshipsparampartsdict[PackURI, Part]Returns
Nonenew
funcnew(blob: bytes, package: Package)Return new EmbeddedPackagePart subclass object.
The returned part object contains blob and is added to package.
paramblobbytesparampackagePackagepart_related_by
funcpart_related_by(reltype: str) -> PartReturn (single) part having relationship to this package of reltype.
Raises KeyError if no such relationship is found and ValueError if more than one such
relationship is found.
paramreltypestrReturns
pptx.opc.package.Partrelate_to
funcrelate_to(target: Part | str, reltype: str, is_external: bool = False) -> strReturn rId key of relationship of reltype to target.
If such a relationship already exists, its rId is returned. Otherwise the relationship is added and its new rId returned.
paramtargetPart | strparamreltypestrparamis_externalbool= FalseReturns
strrelated_part
funcrelated_part(rId: str) -> PartReturn related Part subtype identified by rId.
paramrIdstrReturns
pptx.opc.package.Parttarget_ref
functarget_ref(rId: str) -> strReturn URL contained in target ref of relationship identified by rId.
paramrIdstrReturns
str