openpyxl.preserve.emit
paper-xlsx 0.2.1 API reference
Serialize single cells and rows from the model as bare fragments ready to splice into a default-namespace worksheet stream.
This is a THIN VARIANT of upstream's cell writer
(openpyxl/cell/_writer.py), not a direct call: the style index is an
explicit parameter — the file's xf numbering, from the StyleTranslator —
never cell.style_id (which interns into the MODEL's numbering; model and
file numbering drift on non-openpyxl producers, measured), and the
hyperlink-registration side effect is owned by the hyperlinks planner
instead. The value/formula/date/rich-text emission logic mirrors
_set_attributes/etree_write_cell line for line.
carry_attributes
funccarry_attributes(new_cell_bytes, original_cell_bytes, drop_metadata=False)Attribute-carry rule: re-attach every original cell attribute the replacement does not intentionally rewrite (everything except r, s, t). cm/vm rich-value metadata drops ONLY when the cell's VALUE was overwritten (the cell stops being a rich value) — style-only edits, move re-emissions and dissolution re-emits must carry it.
paramnew_cell_bytesparamoriginal_cell_bytesparamdrop_metadata= Falsecarry_start_tag_attributes
funccarry_start_tag_attributes(new_fragment, original_fragment, skip=())paramnew_fragmentparamoriginal_fragmentparamskip= ()emit_cell
funcemit_cell(ws, cell, style_index)Bytes of one <c> element, or None when the model holds
nothing worth serializing (mirrors the stock writer's skip rule).
style_index is the FILE xf index (StyleTranslator.resolve), or None.
paramwsparamcellparamstyle_indexemit_new_row
funcemit_new_row(ws, index, cells_bytes, attrs)Bytes of a whole new <row> element (sorted cells already emitted).
paramwsparamindexparamcells_bytesparamattrspatch_cell_style
funcpatch_cell_style(original_cell_bytes, style_index)paramoriginal_cell_bytesparamstyle_indexpatch_start_tag_attribute
funcpatch_start_tag_attribute(fragment, name, value)paramfragmentparamnameparamvaluerow_start_tag
funcrow_start_tag(index, attrs, self_closing=False)Bytes of a <row> start tag with the given display attributes.
paramindexparamattrsparamself_closing= False