diff --git a/table.go b/table.go index 1efcd41..b88db4c 100644 --- a/table.go +++ b/table.go @@ -196,18 +196,6 @@ func (f *File) DeleteTable(name string) error { if ws.TableParts.Count = len(ws.TableParts.TableParts); ws.TableParts.Count == 0 { ws.TableParts = nil } - // Delete cell value in the table header - coordinates, err := rangeRefToCoordinates(table.Range) - if err != nil { - return err - } - _ = sortCoordinates(coordinates) - for col := coordinates[0]; col <= coordinates[2]; col++ { - for row := coordinates[1]; row < coordinates[1]+1; row++ { - cell, _ := CoordinatesToCellName(col, row) - err = f.SetCellValue(sheet, cell, nil) - } - } return err } } diff --git a/table_test.go b/table_test.go index aa1980c..0b82b2a 100644 --- a/table_test.go +++ b/table_test.go @@ -122,11 +122,19 @@ func TestDeleteTable(t *testing.T) { f.Sheet.Delete("xl/worksheets/sheet1.xml") f.Pkg.Store("xl/worksheets/sheet1.xml", MacintoshCyrillicCharset) assert.EqualError(t, f.DeleteTable("Table1"), "XML syntax error on line 1: invalid UTF-8") - // Test delete table with invalid table range + // Test delete table without deleting table header f = NewFile() - assert.NoError(t, f.AddTable("Sheet1", &Table{Range: "A1:B4", Name: "Table1"})) - f.Pkg.Store("xl/tables/table1.xml", []byte("