summaryrefslogtreecommitdiff
path: root/excelize_test.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 /excelize_test.go
parente780e41e0222517caa9c69030b5955ab2b458a49 (diff)
resolve the issue corrupted xlsx after deleting formula of cell, reference #346
Diffstat (limited to 'excelize_test.go')
-rw-r--r--excelize_test.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/excelize_test.go b/excelize_test.go
index ebbfcf7..d621b87 100644
--- a/excelize_test.go
+++ b/excelize_test.go
@@ -342,8 +342,18 @@ func TestSetCellFormula(t *testing.T) {
xlsx.SetCellFormula("Sheet1", "C19", "SUM(Sheet2!D2,Sheet2!D9)")
// Test set cell formula with illegal rows number.
xlsx.SetCellFormula("Sheet1", "C", "SUM(Sheet2!D2,Sheet2!D9)")
+ assert.NoError(t, xlsx.SaveAs(filepath.Join("test", "TestSetCellFormula1.xlsx")))
- assert.NoError(t, xlsx.SaveAs(filepath.Join("test", "TestSetCellFormula.xlsx")))
+ xlsx, err = OpenFile(filepath.Join("test", "CalcChain.xlsx"))
+ if !assert.NoError(t, err) {
+ t.FailNow()
+ }
+ // Test remove cell formula.
+ xlsx.SetCellFormula("Sheet1", "A1", "")
+ assert.NoError(t, xlsx.SaveAs(filepath.Join("test", "TestSetCellFormula2.xlsx")))
+ // Test remove all cell formula.
+ xlsx.SetCellFormula("Sheet1", "B1", "")
+ assert.NoError(t, xlsx.SaveAs(filepath.Join("test", "TestSetCellFormula3.xlsx")))
}
func TestSetSheetBackground(t *testing.T) {