summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--excelize.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/excelize.go b/excelize.go
index b4f7acc..86e2d99 100644
--- a/excelize.go
+++ b/excelize.go
@@ -138,8 +138,12 @@ func completeCol(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
// Completion row element tags of XML in a sheet.
func completeRow(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
- if len(xlsx.SheetData.Row) >= row {
- row = len(xlsx.SheetData.Row)
+ currentRows := len(xlsx.SheetData.Row)
+ if currentRows > 1 {
+ lastRow := xlsx.SheetData.Row[currentRows-1].R
+ if lastRow >= row {
+ row = lastRow
+ }
}
sheetData := xlsxSheetData{}
existsRows := map[int]int{}