summaryrefslogtreecommitdiff
path: root/cell.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-02-22 22:17:38 +0800
committerxuri <xuri.me@gmail.com>2019-02-22 22:17:38 +0800
commit0072bb731043f89ce978778b9d7fdc6160e29de0 (patch)
treec44726082c606dbbcf6fa5c1dfba31cd81993c84 /cell.go
parente780e41e0222517caa9c69030b5955ab2b458a49 (diff)
resolve the issue corrupted xlsx after deleting formula of cell, reference #346
Diffstat (limited to 'cell.go')
-rw-r--r--cell.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cell.go b/cell.go
index afe8635..3cf880a 100644
--- a/cell.go
+++ b/cell.go
@@ -305,6 +305,11 @@ func (f *File) SetCellFormula(sheet, axis, formula string) {
completeRow(xlsx, rows, cell)
completeCol(xlsx, rows, cell)
+ if formula == "" {
+ xlsx.SheetData.Row[xAxis].C[yAxis].F = nil
+ f.deleteCalcChain(axis)
+ return
+ }
if xlsx.SheetData.Row[xAxis].C[yAxis].F != nil {
xlsx.SheetData.Row[xAxis].C[yAxis].F.Content = formula
} else {