Skip to content

feat(PivotTable): sourceRef - #78

Open
ShaMan123 wants to merge 3 commits into
protobi:masterfrom
ShaMan123:feat/pivot-table-sourceRef
Open

ShaMan123 wants to merge 3 commits into
protobi:masterfrom
ShaMan123:feat/pivot-table-sourceRef

Conversation

@ShaMan123

@ShaMan123 ShaMan123 commented May 18, 2026 •

Copy link
Copy Markdown

Summary

I want to be able to add pivot tables that source data from a certian range
closes #43

Files changed

lib/doc/pivot-table.js
lib/xlsx/xform/pivot-table/pivot-cache-definition-xform.js
lib/xlsx/xform/pivot-table/pivot-cache-records-xform.js
spec/integration/workbook/pivot-tables-source-ref.spec.js
index.d.ts

Test plan

spec/integration/workbook/pivot-tables-source-ref.spec.js

Related to source code (for typings update)

Checklist

  • Only the lines required for the fix/feature are changed (no formatter sweeps, no drive-by refactors)
  • Tests use real fixture round-trip (wb.xlsx.load / writeBuffer), not synthetic model objects, where possible
  • Checked open PRs (gh pr list --state open) for conflicting changes to the same files
  • (If serialization is touched) Output verified to open in Excel, or soffice --headless round-trip clean
  • (If --no-verify was used to bypass the pre-commit hook) Reason explained above
  • (If a major dep was bumped) Runtime smoke test described above

@ShaMan123 ShaMan123 changed the title feat(PivotTable): feat(PivotTable): sourceRef May 18, 2026
@ShaMan123

Copy link
Copy Markdown
Author

lint and husky make it quite hard to PR

Anchor the pivot table itself, the way `sourceRef` anchors its source data.
The `<location>` element was written with a hardcoded `ref="A3:E15"`, so a
destination sheet could carry nothing above the table.

`firstHeaderRow`, `firstDataRow` and `firstDataCol` are defined relative to the
top left cell of `ref` (ISO/IEC 29500-1, CT_Location), so moving the anchor
leaves them alone; only the range is recomputed, keeping the nominal extent
Excel recalculates on load anyway.

Defaults to A3, so output is unchanged when `ref` is omitted.

Committed with --no-verify: the pre-commit eslint hook fails on two errors
that predate this change in pivot-table-xform.js (an unused `pageDefaults`
destructure and a 139-char line in renderPivotField). Fixing them here would
be a drive-by edit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] addPivotTable sheet range/table source

1 participant