xlsx/preserve-shared-formula-text

Excel's canonical shared-formula shape is an anchor cell carrying f@t='shared' @ref='A1:A5' @si='0' with the formula text, followed by N-1 'follower' cells with f@t='shared' @si='0' and the same formula text. W8-D preserved the group structure (anchor + @ref + @si survive) but the follower cells lose their formula text on save. Schema-legal (Excel re-derives the text from the anchor) and Excel-idempotent, but third-party consumers that iterate cells in isolation (not through the shared-formula machinery) see empty formulas. Tombstoned so follow-up work has a conformance target.

Library verdicts: python-xlsx: — xlsxjs: —

Metadata

Feature idxlsx/preserve-shared-formula-text
Formatxlsx
Categoryround-trip
Spececma-376-5-part-1 § 18.3.1.40 f

XPath assertions

ID / partPredicateXPathpython-xlsxxlsxjs
shared-formula-follower-text-preserved
xl/worksheets/sheet1.xml
equal = A1+1
The B2 follower cell's <f t='shared' si='0'> element must carry the same formula text the anchor (B1) carries. Currently FAILS — python-xlsx strips the text on save.
//x:c[@r='B2']/x:f[@t='shared' and @si='0']

Render assertions

No render assertions declared.

Manifest (expanded)

{
  "$schema": "../manifest.schema.json",
  "id": "xlsx/preserve-shared-formula-text",
  "title": "Preserve <f t=\"shared\"> text on non-anchor group members (KNOWN FAILING — python-xlsx bug)",
  "format": "xlsx",
  "category": "round-trip",
  "summary": "Excel's canonical shared-formula shape is an anchor cell carrying f@t='shared' @ref='A1:A5' @si='0' with the formula text, followed by N-1 'follower' cells with f@t='shared' @si='0' and the same formula text. W8-D preserved the group structure (anchor + @ref + @si survive) but the follower cells lose their formula text on save. Schema-legal (Excel re-derives the text from the anchor) and Excel-idempotent, but third-party consumers that iterate cells in isolation (not through the shared-formula machinery) see empty formulas. Tombstoned so follow-up work has a conformance target.",
  "roles": [
    "authoring"
  ],
  "spec": {
    "source": "ecma-376-5-part-1",
    "clause": "18.3.1.40",
    "element": "f",
    "xsd_reference": "spec/ecma-376-5/part-1/xsd/sml.xsd",
    "notes": "ECMA-376 Part 1 §18.3.1.40 defines CT_CellFormula; clause 18.17.6 discusses shared-formula semantics. @t='shared' with @si='<k>' and no @ref marks a follower; its text() is optional but — when present — redundantly repeats the anchor's formula. Word, Excel, and LibreOffice all emit the redundant text by default; python-xlsx strips it on save. This manifest asserts that follower cells' text() survives the round-trip."
  },
  "fixtures": {
    "machine": "xlsx/preserve-shared-formula-text"
  },
  "round_trip": {
    "library": "python-xlsx",
    "source_fixture": "xlsx/shared-formula"
  },
  "assertions": [
    {
      "id": "shared-formula-follower-text-preserved",
      "part": "xl/worksheets/sheet1.xml",
      "namespaces": {
        "x": "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
      },
      "xpath": "//x:c[@r='B2']/x:f[@t='shared' and @si='0']",
      "must": "equal",
      "value": "A1+1",
      "description": "The B2 follower cell's <f t='shared' si='0'> element must carry the same formula text the anchor (B1) carries. Currently FAILS — python-xlsx strips the text on save."
    }
  ]
}

Fixture

Fixture file not found on disk.

Reference preview

No rendered reference is available for this case.

Spec notes

ECMA-376 Part 1 §18.3.1.40 defines CT_CellFormula; clause 18.17.6 discusses shared-formula semantics. @t='shared' with @si='<k>' and no @ref marks a follower; its text() is optional but — when present — redundantly repeats the anchor's formula. Word, Excel, and LibreOffice all emit the redundant text by default; python-xlsx strips it on save. This manifest asserts that follower cells' text() survives the round-trip.