Paper Office
paper-pptxAPI referenceopc.package

_Relationship

paper-pptx 0.2.0 API reference

Value object describing link from a part or package to another part.

_Relationship(base_uri: str, rId: str, reltype: str, target_mode: str, target: Part | str)

Attributes

is_external

attributeis_externalbool

True if target_mode is RTM.EXTERNAL.

An external relationship is a link to a resource outside the package, such as a web-resource (URL).

rId

attributerIdstr

str relationship-id, like 'rId9'.

Corresponds to the Id attribute on the CT_Relationship element and uniquely identifies this relationship within its peers for the source-part or package.

reltype

attributereltypestr

Member of RELATIONSHIP_TYPE describing relationship of target to source.

target_part

attributetarget_partPart

Part or subtype referred to by this relationship.

target_partname

attributetarget_partnamePackURI

PackURI instance containing partname targeted by this relationship.

Raises ValueError on reference if target_mode is external. Use :attr:target_mode to check before referencing.

target_ref

attributetarget_refstr

str reference to relationship target.

For internal relationships this is the relative partname, suitable for serialization purposes. For an external relationship it is typically a URL.

Functions

from_xml

funcfrom_xml(base_uri: str, rel: CT_Relationship, parts: dict[PackURI, Part]) -> _Relationship

Return _Relationship object based on CT_Relationship element rel.

parambase_uristr
paramrelCT_Relationship
parampartsdict[PackURI, Part]

Returns

pptx.opc.package._Relationship

On this page