summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2016-09-02 19:06:48 +0800
committerRi Xu <xuri.me@gmail.com>2016-09-02 19:06:48 +0800
commit7bd8d9ee5b6952af85f555ac0d74910f87ea71f9 (patch)
tree7f080b5dad0d5cf5d7757ebb220e4657c580b727
parent192af02a40cc745d967be1c96fcc52569ca8e8df (diff)
Fix checkRow() out of range
-rw-r--r--excelize.go4
-rw-r--r--test/Workbook1.xlsxbin18199 -> 18204 bytes
2 files changed, 3 insertions, 1 deletions
diff --git a/excelize.go b/excelize.go
index ba474cf..5ac7660 100644
--- a/excelize.go
+++ b/excelize.go
@@ -42,7 +42,6 @@ func SetCellInt(file []FileList, sheet string, axis string, value int) []FileLis
cell := yAxis + 1
xlsx = checkRow(xlsx)
-
xlsx = completeRow(xlsx, rows, cell)
xlsx = completeCol(xlsx, rows, cell)
@@ -173,6 +172,9 @@ func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
func checkRow(xlsx xlsxWorksheet) xlsxWorksheet {
for k, v := range xlsx.SheetData.Row {
lenCol := len(v.C)
+ if lenCol < 1 {
+ continue
+ }
endR := getColIndex(v.C[lenCol-1].R)
endRow := getRowIndex(v.C[lenCol-1].R)
endCol := titleToNumber(endR)
diff --git a/test/Workbook1.xlsx b/test/Workbook1.xlsx
index 54810bc..05b51c2 100644
--- a/test/Workbook1.xlsx
+++ b/test/Workbook1.xlsx
Binary files differ