diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-10-16 10:42:43 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-10-16 10:42:43 +0800 |
commit | 9b5b74d4801f60daa580fd282ff9fa058bb03385 (patch) | |
tree | 932febf22a36d6b03095070c98ac94c690ab59ef /rows.go | |
parent | 905be463edc6d9b0ed184bdee0116217a5118c5e (diff) |
Performance optimization, use the array index instead of the value in range.
Diffstat (limited to 'rows.go')
-rw-r--r-- | rows.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 |