Paper Office
paper-xlsxAPI referencepreserve.regions

openpyxl.preserve.regions

paper-xlsx 0.2.1 API reference

Fully-modeled worksheet satellite elements: faithful serialization, change detection, and the write-policy gates.

Change detection compares the MODEL's serialization at arm time against the model's serialization at save time — never model-vs-original-bytes, which would false-positive on every producer quirk openpyxl normalizes at load (xr:uid drops, attribute defaults, ...). Self-consistent serialization means a region is dirty exactly when the USER changed it. When a region is dirty, the splice replaces the whole element with the model serialization — legal because these elements are fully modeled (round-trip identity proven), subject to the write-policy gates.

Serializers mirror openpyxl/worksheet/_writer.py's per-element logic exactly; a serializer returning None means "stock would not emit this element" (absent).

CT_ORDER_INDEX

attributeCT_ORDER_INDEX
= {tag: i for i, tag in (enumerate(CT_WORKSHEET_ORDER))}

CT_WORKSHEET_ORDER

attributeCT_WORKSHEET_ORDER
= ['sheetPr', 'dimension', 'sheetViews', 'sheetFormatPr', 'cols', 'sheetData', 'sheetCalcPr', 'sheetProtection', 'protectedRanges', 'scenarios', 'autoFilter', 'sortState', 'dataConsolidate', 'customSheetViews', 'mergeCells', 'phoneticPr', 'conditionalFormatting', 'dataValidations', 'hyperlinks', 'printOptions', 'pageMargins', 'pageSetup', 'headerFooter', 'rowBreaks', 'colBreaks', 'customProperties', 'cellWatches', 'ignoredErrors', 'smartTags', 'drawing', 'legacyDrawing', 'legacyDrawingHF', 'picture', 'oleObjects', 'controls', 'webPublishItems', 'tableParts', 'extLst']

DETECT_ONLY_REGIONS

attributeDETECT_ONLY_REGIONS
= []

REGION_BY_TAG

attributeREGION_BY_TAG
= {(r.tag): r for r in SPLICEABLE_REGIONS}

SAVER_CRAFTED_REGIONS

attributeSAVER_CRAFTED_REGIONS
= frozenset(['tableParts', 'legacyDrawing', 'extLst', 'drawing'])

SPLICEABLE_REGIONS

attributeSPLICEABLE_REGIONS
= [Region('sheetPr', _sheet_pr), Region('sheetViews', _views), Region('sheetFormatPr', _sheet_format), Region('cols', _cols), Region('sheetProtection', _protection), Region('scenarios', _scenarios), Region('autoFilter', _auto_filter), Region('mergeCells', _merged), Region('dataValidations', _validations), Region('printOptions', _print_options), Region('pageMargins', _margins), Region('pageSetup', _page_setup), Region('headerFooter', _header), Region('rowBreaks', _row_breaks), Region('colBreaks', _col_breaks)]

On this page