From 40ed1d1b81b4d30165bb73e9406e59ddbdb76fe2 Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 16 Jul 2022 12:50:13 +0800 Subject: Fix potential file corrupted when changing cell value or the col/row - Remove shared formula subsequent cell when setting the cell values - Support adjust table range when removing and inserting column/row --- table_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'table_test.go') diff --git a/table_test.go b/table_test.go index 0a74b1b..5941c50 100644 --- a/table_test.go +++ b/table_test.go @@ -45,6 +45,12 @@ func TestAddTable(t *testing.T) { assert.EqualError(t, f.addTable("sheet1", "", 1, 1, 0, 0, 0, nil), "invalid cell coordinates [0, 0]") } +func TestSetTableHeader(t *testing.T) { + f := NewFile() + _, err := f.setTableHeader("Sheet1", 1, 0, 1) + assert.EqualError(t, err, "invalid cell coordinates [1, 0]") +} + func TestAutoFilter(t *testing.T) { outFile := filepath.Join("test", "TestAutoFilter%d.xlsx") @@ -72,7 +78,7 @@ func TestAutoFilter(t *testing.T) { }) } - // testing AutoFilter with illegal cell coordinates. + // Test AutoFilter with illegal cell coordinates. assert.EqualError(t, f.AutoFilter("Sheet1", "A", "B1", ""), newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error()) assert.EqualError(t, f.AutoFilter("Sheet1", "A1", "B", ""), newCellNameToCoordinatesError("B", newInvalidCellNameError("B")).Error()) } -- cgit v1.2.1