Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (s *Sheet) maybeAddRow(rowCount int) {
loopCnt := rowCount - s.MaxRow
for i := 0; i < loopCnt; i++ {
row := s.cellStore.MakeRow(s)
row.num = i
row.num = s.MaxRow + i
s.setCurrentRow(row)
}
s.MaxRow = rowCount
Expand Down
22 changes: 22 additions & 0 deletions sheet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,25 @@ func TestTemp(t *testing.T) {
c.Assert(xSI.T.Text, qt.Equals, "A cell!")
c.Assert(xSI.R, qt.HasLen, 0)
}

func TestAddEmptyRow(t *testing.T) {
c := qt.New(t)
sourceFile, err := OpenFile("./testdocs/original.xlsx")
c.Assert(err, qt.IsNil)
sheet := sourceFile.Sheets[0]
c.Assert(sheet, qt.IsNotNil)
firstRow, err := sheet.Row(0)
c.Assert(err, qt.IsNil)
cellStr := firstRow.GetCell(0).String()
t.Logf("cell: %s", cellStr)

maxRow := sheet.MaxRow
_, err = sheet.Row(maxRow)
c.Assert(err, qt.IsNil)

firstRow, err = sheet.Row(0)
c.Assert(err, qt.IsNil)
cellStr2 := firstRow.GetCell(0).String()
t.Logf("cell: %s", cellStr2)
c.Assert(cellStr, qt.Equals, cellStr2)
}
Loading