summaryrefslogtreecommitdiff
path: root/cell.go
diff options
context:
space:
mode:
authorMarch <115345952+March0715@users.noreply.github.com>2022-11-08 00:35:19 +0800
committerGitHub <noreply@github.com>2022-11-08 00:35:19 +0800
commit8753950d62c150034a919599a7762cef19035552 (patch)
tree0acf27fffd917ae74ef1b06354dde99162eda8a3 /cell.go
parent75c912ca952bf47bbe421030554ef580ff4f3996 (diff)
Delete shared formula in calc chain when writing a formula cell (#1387)
Diffstat (limited to 'cell.go')
-rw-r--r--cell.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/cell.go b/cell.go
index ebf4681..c8fa9b2 100644
--- a/cell.go
+++ b/cell.go
@@ -175,13 +175,15 @@ func (c *xlsxC) hasValue() bool {
// removeFormula delete formula for the cell.
func (f *File) removeFormula(c *xlsxC, ws *xlsxWorksheet, sheet string) {
if c.F != nil && c.Vm == nil {
- f.deleteCalcChain(f.getSheetID(sheet), c.R)
+ sheetID := f.getSheetID(sheet)
+ f.deleteCalcChain(sheetID, c.R)
if c.F.T == STCellFormulaTypeShared && c.F.Ref != "" {
si := c.F.Si
for r, row := range ws.SheetData.Row {
for col, cell := range row.C {
if cell.F != nil && cell.F.Si != nil && *cell.F.Si == *si {
ws.SheetData.Row[r].C[col].F = nil
+ f.deleteCalcChain(sheetID, cell.R)
}
}
}