Skip to content

fix: clear shared formula when overwriting with a normal formula (#2337) - #2338

Merged
xuri merged 3 commits into
qax-os:masterfrom
Aprax14:fix-shared-formula-overwrite
Jun 11, 2026
Merged

fix: clear shared formula when overwriting with a normal formula (#2337)#2338
xuri merged 3 commits into
qax-os:masterfrom
Aprax14:fix-shared-formula-overwrite

Conversation

@Aprax14

@Aprax14 Aprax14 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

PR Details

Make SetCellFormula overwrite existing shared formula

Description

When SetCellFormula overwrites a cell that belongs to a shared formula range, it updated only c.F.Content but left c.F.T, c.F.Si, and c.F.Ref intact. As a result, GetCellFormula still resolved via the shared formula and returned the same formula for every cell in the range.

Related Issue

#2337

Motivation and Context

Fix silent wrong data when writing individual formulas over a shared formula range.

How Has This Been Tested

Added unit test

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@xuri xuri added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 10, 2026
@xuri xuri moved this to BugFix in Excelize v2.11.0 Jun 10, 2026
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (eb84319) to head (205cdbc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2338      +/-   ##
==========================================
- Coverage   99.60%   99.59%   -0.02%     
==========================================
  Files          32       32              
  Lines       26864    26862       -2     
==========================================
- Hits        26758    26753       -5     
- Misses         55       57       +2     
- Partials       51       52       +1     
Flag Coverage Δ
unittests 99.59% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xuri xuri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. I've made some changes based on your branch.

@xuri
xuri merged commit c88ce10 into qax-os:master Jun 11, 2026
20 of 21 checks passed
xuri added a commit that referenced this pull request Jun 15, 2026
- Remove dead code for resolve indirect code coverage decrease caused by #2338
xuri added a commit that referenced this pull request Jun 16, 2026
…ivot table data fields

- Add new exported PivotTableShowValueAs data type
- Add new exported PivotTableShowValueAsType enumeration
- Add new exported 3 error variables ErrPivotTableShowValueAsBaseField, ErrPivotTableShowValueAsBaseItem and ErrUnsupportedPivotTableShowValueAsType
- Add new field ShowValueAs in the PivotTableField data type
- Check reference before set shared formula to prevent generate corrupted workbook, related with #2338
- Idempotency setting and reading of the Subtotal data field in a PivotTable
- Update unit tests
@xuri

xuri commented Jun 16, 2026

Copy link
Copy Markdown
Member

Follow up, note that this changes will cause generate corrupted workbook TestSetCellFormula5.xlsx. I fixed it in commit 4ae56a6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

No open projects
Status: BugFix

Development

Successfully merging this pull request may close these issues.

SetCellFormula does not clear shared formula metadata when overwriting with a normal formula

2 participants