From 9b5b74d4801f60daa580fd282ff9fa058bb03385 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Mon, 16 Oct 2017 10:42:43 +0800 Subject: Performance optimization, use the array index instead of the value in range. --- rows.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'rows.go') diff --git a/rows.go b/rows.go index 9bbbec2..78ed664 100644 --- a/rows.go +++ b/rows.go @@ -266,11 +266,11 @@ func (f *File) InsertRow(sheet string, row int) { // 3000 rows one sheet). func checkRow(xlsx *xlsxWorksheet) { buffer := bytes.Buffer{} - for k, v := range xlsx.SheetData.Row { - lenCol := len(v.C) + for k := range xlsx.SheetData.Row { + lenCol := len(xlsx.SheetData.Row[k].C) if lenCol > 0 { - endR := string(strings.Map(letterOnlyMapF, v.C[lenCol-1].R)) - endRow, _ := strconv.Atoi(strings.Map(intOnlyMapF, v.C[lenCol-1].R)) + endR := string(strings.Map(letterOnlyMapF, xlsx.SheetData.Row[k].C[lenCol-1].R)) + endRow, _ := strconv.Atoi(strings.Map(intOnlyMapF, xlsx.SheetData.Row[k].C[lenCol-1].R)) endCol := TitleToNumber(endR) + 1 if lenCol < endCol { oldRow := xlsx.SheetData.Row[k].C -- cgit v1.2.1