Skip to content

Commit 76cd099

Browse files
committed
This closes #1539, fix adjust table issue when after removing rows
1 parent c232748 commit 76cd099

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

adjust.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func (f *File) adjustTable(ws *xlsxWorksheet, sheet string, dir adjustDirection,
242242
}
243243
coordinates = f.adjustAutoFilterHelper(dir, coordinates, num, offset)
244244
x1, y1, x2, y2 := coordinates[0], coordinates[1], coordinates[2], coordinates[3]
245-
if y2-y1 < 2 || x2-x1 < 1 {
245+
if y2-y1 < 1 || x2-x1 < 0 {
246246
ws.TableParts.TableParts = append(ws.TableParts.TableParts[:idx], ws.TableParts.TableParts[idx+1:]...)
247247
ws.TableParts.Count = len(ws.TableParts.TableParts)
248248
idx--

adjust_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ func TestAdjustTable(t *testing.T) {
320320
}
321321
assert.NoError(t, f.RemoveRow(sheetName, 2))
322322
assert.NoError(t, f.RemoveRow(sheetName, 3))
323+
assert.NoError(t, f.RemoveRow(sheetName, 3))
323324
assert.NoError(t, f.RemoveCol(sheetName, "H"))
324325
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestAdjustTable.xlsx")))
325326

0 commit comments

Comments
 (0)