From 7bd8d9ee5b6952af85f555ac0d74910f87ea71f9 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Fri, 2 Sep 2016 19:06:48 +0800 Subject: [PATCH] Fix checkRow() out of range --- excelize.go | 4 +++- test/Workbook1.xlsx | Bin 18199 -> 18204 bytes 2 files changed, 3 insertions(+), 1 deletion(-) 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 54810bcab2f10d0162cbd49761cb3f7198096abc..05b51c27d7823ff3abce08a1df4c479b1af2727a 100644 GIT binary patch delta 1190 zcmbQ<$2g~tal;ixrgzgeUt=@_(|pXH%s~F+NH%$pa21;$NOpw5Vv1h z1H|2_JdYhjM`|DC00}FYXo0vsChwT|1g9%`w$6*Yw2p~^!HaWpgQ;Y_kzPe^&fICI z`)(PCw0)oYi*Mq0=K{SJg+m!!Ql(;{t5;3m>M0}SE3|wYd)xN+ox%r_n_1R;csl3* z|C*vEpZxlgzF8HbaNBb)Ay(eEvtFlH7$73$|bvs_I|8*bZtpa zzNegj?}S}yPAskKWeID*ChnfG`hmUbUC!J$C12x=zuoeU+r-i<_~ugAvQ3i}K5Sm<9TmzMmBc^qrhP!@ zW4}wbujU+6|C=5|LpSEG^2Q1v4sn>r}wUJ2R1WUdMQ}d>kAxeyrlPhrFYQE4T=e+yAKqX zb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