summaryrefslogtreecommitdiff
path: root/rows.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-10-16 10:42:43 +0800
committerRi Xu <xuri.me@gmail.com>2017-10-16 10:42:43 +0800
commit9b5b74d4801f60daa580fd282ff9fa058bb03385 (patch)
tree932febf22a36d6b03095070c98ac94c690ab59ef /rows.go
parent905be463edc6d9b0ed184bdee0116217a5118c5e (diff)
Performance optimization, use the array index instead of the value in range.
Diffstat (limited to 'rows.go')
-rw-r--r--rows.go8
1 files changed, 4 insertions, 4 deletions
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