PartPlan
paper-xlsx 0.2.1 API reference
Adds/removals of whole parts for one save, with their content-type and relationship consequences planned in lockstep.
PartPlan(existing_names)Attributes
added
attributeadded= {}ct_defaults
attributect_defaults= []ct_overrides
attributect_overrides= []ct_removals
attributect_removals= []dropped
attributedropped= set()existing
attributeexisting= set(existing_names)rel_appends
attributerel_appends= {}rel_removals
attributerel_removals= {}Functions
add_default
funcadd_default(extension, content_type)paramextensionparamcontent_typeadd_part
funcadd_part(name, payload, content_type=None, relate_from=None, rel_type=None, rel_id=None)Plan a new part; returns the allocated relationship id (or
rel_id when given). relate_from names the part whose rels
must point at the new part (its rels part is created if absent —
the saver resolves ids at apply time via resolve_rel_ids).
paramnameparampayloadparamcontent_type= Noneparamrelate_from= Noneparamrel_type= Noneparamrel_id= Noneapply_content_types
funcapply_content_types(payload)parampayloadapply_rels
funcapply_rels(rels_part, payload)The updated payload for one rels part (payload is None when
the part does not exist yet — a fresh rels document is built).
paramrels_partparampayloadremove_part
funcremove_part(name, referencing_rels=())Plan a part's removal: dropped from the copy loop, its
content-type override removed, and the named relationships cut.
referencing_rels is [(rels_part, target_suffix)].
paramnameparamreferencing_rels= ()reserve_rid
funcreserve_rid(rels_part, existing_payload)Sequential rId allocation shared by every planner touching one rels part (two independent next_rid computations collide).
paramrels_partparamexisting_payloadtouched_rels_parts
functouched_rels_parts()