Paper Office
paper-xlsxAPI referencepreserve.emit

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_bytes
paramoriginal_cell_bytes
paramdrop_metadata
= False

carry_start_tag_attributes

funccarry_start_tag_attributes(new_fragment, original_fragment, skip=())
paramnew_fragment
paramoriginal_fragment
paramskip
= ()

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.

paramws
paramcell
paramstyle_index

emit_new_row

funcemit_new_row(ws, index, cells_bytes, attrs)

Bytes of a whole new <row> element (sorted cells already emitted).

paramws
paramindex
paramcells_bytes
paramattrs

patch_cell_style

funcpatch_cell_style(original_cell_bytes, style_index)
paramoriginal_cell_bytes
paramstyle_index

patch_start_tag_attribute

funcpatch_start_tag_attribute(fragment, name, value)
paramfragment
paramname
paramvalue

row_start_tag

funcrow_start_tag(index, attrs, self_closing=False)

Bytes of a <row> start tag with the given display attributes.

paramindex
paramattrs
paramself_closing
= False

On this page