NotesMasterPart
paper-pptx 0.2.0 API reference
Notes master part.
Corresponds to package file ppt/notesMasters/notesMaster1.xml.
Attributes
blob
attributeblobbytesbytes XML serialization of this part.
content_type
attributecontent_typestrContent-type (MIME-type) of this part.
name
attributenamestrInternal name of this slide.
notes_master
attributenotes_masterReturn the NotesMaster object that proxies this notes master part.
package
attributepackagePackagePackage this part belongs to.
part
attributepartThis part.
This is part of the parent protocol, "children" of the document will not know the part that contains them so must ask their parent object. That chain of delegation ends here for child objects.
partname
attributepartnamePackURIPackURI partname for this part, e.g. "/ppt/slides/slide1.xml".
rels
attributerels_RelationshipsCollection of relationships from this part to other parts.
Functions
create_default
funccreate_default(package)Create and return a default notes master part, including creating the new theme it requires.
parampackagedrop_rel
funcdrop_rel(rId: str) -> NoneRemove relationship identified by rId if its reference count is under 2.
Relationships with a reference count of 0 are implicit relationships. Note that only XML parts can drop relationships.
paramrIdstrReturns
Noneget_image
funcget_image(rId: str) -> ImageReturn an Image object containing the image related to this slide by rId.
Raises KeyError if no image is related by that id, which would generally indicate a
corrupted .pptx file.
paramrIdstrReturns
pptx.parts.image.Imageget_or_add_image_part
funcget_or_add_image_part(image_file: str | IO[bytes])Return (image_part, rId) pair corresponding to image_file.
The returned ImagePart object contains the image in image_file and is
related to this slide with the key rId. If either the image part or
relationship already exists, they are reused, otherwise they are newly created.
paramimage_filestr | IO[bytes]load
funcload(partname: PackURI, content_type: str, package: Package, blob: bytes)Return instance of cls loaded with parsed XML from blob.
parampartnamePackURIparamcontent_typestrparampackagePackageparamblobbytesload_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
Nonepart_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