Paper Office
paper-xlsxAPI referencepreserve.ledger

openpyxl.preserve.ledger

paper-xlsx 0.2.1 API reference

Records what the object model changed, so the splice save can apply exactly those edits to the retained package and nothing else.

The ledger is load-bearing, not an optimization: a compare-based patch-save is impossible here because stock serialization of a whole sheet is the lossy act — there is nothing faithful to compare. (Fully-modeled satellite elements are the sanctioned exception: their arm-time model serializations are snapshotted below and compared against save-time re-serializations — self-consistent, so USER changes are detected with zero producer-quirk noise.)

What the ledger holds:

  • per-cell dirt, keyed by worksheet object: the coordinates whose model state must be spliced into the original sheet XML (a dirty coordinate absent from the model means the cell was deleted);
  • formulas_changed — drives the calcChain deletion cascade and the recalc-on-load flag;
  • sheets added in-session (generated whole at save; also exempt from the rename/remove refusals that protect loaded sheets);
  • a fingerprint of the interned style components taken when the ledger armed, so the save can refuse if a shared style object was mutated in place (the StyleProxy nested-leak — silent fan-out corruption upstream).

The ledger ARMS only after load completes: the reader itself fires cell binds, create_sheet and style writes while building the model, and pure reads may materialize cells and dimensions afterwards — the ledger keys on semantic mutation through public setters, never on materialization.

On this page