@yudaocode/univer-docs 1.6.213 → 1.6.215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -207,3 +207,20 @@ When exporting an **unfilled template** `IDocumentData` to `.docx` via `exportDo
207
207
 
208
208
  - Complex `<w:fldChar w:fldCharType="begin\|separate\|end"/>` + `<w:instrText>` and `<w:fldSimple>` fields in body, table cells, headers, and footers are parsed into `yudaoBlockKind: "docField"` custom ranges (`fieldInstr`, `fieldSimple`), preserving cached display runs for Univer canvas preview and re-emitting live OOXML fields plus `<w:updateFields w:val="true"/>` in `word/settings.xml` on `.docx` export.
209
209
  - Browser `decodeDocx` / `parseDocxBytesWithReport` emits an explicit compatibility warning (`code: "UNSUPPORTED_FIELD"`) whenever dynamic `PAGE` / `NUMPAGES` fields are detected so hosts and users know canvas preview displays cached static text rather than live page numbers.
210
+
211
+ ### 5.5 Table Cell Margins (`w:tcMar` / `w:tblCellMar`), Table `borderDefaults`, SDT Shading & DEFLATE Packaging
212
+
213
+ - **4-Level Per-Side Cell Margin Cascade on `decodeDocx`**:
214
+ - Recognizes both `w:left` / `w:start` and `w:right` / `w:end`, converting `1 pt = 20 twip (dxa)` (`w:type="nil"` -> `0`, `w:type="pct"` -> approximated to `pt` with explicit `PCT_CELL_MARGIN_APPROXIMATED` import warning).
215
+ - Each side (`top`, `bottom`, `start`, `end`) resolves independently across 4 levels (first defined value wins):
216
+ 1. Cell `<w:tcPr><w:tcMar>`
217
+ 2. Row `<w:tblPrEx><w:tblCellMar>` -> Table `<w:tblPr><w:tblCellMar>`
218
+ 3. Table style `<w:style w:type="table"><w:tblPr><w:tblCellMar>` in `word/styles.xml` (walking `w:basedOn` chain)
219
+ 4. OOXML Normal Table default (`ECMA-376 §17.4.42`): `top: 0`, `bottom: 0`, `start: 5.4` (`108 dxa`), `end: 5.4` (`108 dxa`).
220
+ - Resolved `cell.margin` is written onto every `ITableCell` (and cloned across `tableRowLoops`), while table-level defaults are also preserved on `ITable.cellMargin`.
221
+ - **Schema-Ordered `encodeDocx` Margin & Border Serialization**:
222
+ - When `table.cellMargin` is present on `ITable`, `<w:tblCellMar>` is emitted in `<w:tblPr>` (after `<w:tblLayout>`), and `<w:tcMar>` is emitted only on cells whose `cell.margin` differs from `table.cellMargin`. When `table.cellMargin` is absent (e.g., server-expanded snapshots), `<w:tcMar>` is emitted on every cell with `margin`.
223
+ - **Zero-value preservation**: Sides whose value is `0` (`0 pt`) are always written explicitly as `w:w="0" w:type="dxa"` and never omitted (since omitting a side falls back to OOXML `108 dxa` on `left`/`right`).
224
+ - `<w:tcPr>` follows strict `CT_TcPr` element order: `w:tcW` -> `w:gridSpan` -> `w:vMerge` -> `w:tcBorders` -> `w:shd` -> `w:tcMar` -> `w:vAlign`.
225
+ - `<w:tblBorders>` serializes `ITable.borderDefaults` colors/widths/dash styles directly, and non-merged cells without cell-level border overrides omit redundant `<w:tcBorders>`.
226
+ - Author run shading on `<w:sdt>` controls (e.g. `#EFF6FF`) is preserved across `decodeDocx` / `encodeDocx` (only transient editor placeholder chrome `#f3f5ff` / `#eeeff1` is stripped), and `.docx` archives pack XML/JSON parts with standard RFC 1951 `DEFLATE` (`method = 8`).