summaryrefslogtreecommitdiff
path: root/excelize.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 /excelize.go
parent905be463edc6d9b0ed184bdee0116217a5118c5e (diff)
Performance optimization, use the array index instead of the value in range.
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/excelize.go b/excelize.go
index e3b5dac..95bce34 100644
--- a/excelize.go
+++ b/excelize.go
@@ -113,8 +113,8 @@ func checkSheet(xlsx *xlsxWorksheet) {
}
sheetData := xlsxSheetData{}
existsRows := map[int]int{}
- for k, v := range xlsx.SheetData.Row {
- existsRows[v.R] = k
+ for k := range xlsx.SheetData.Row {
+ existsRows[xlsx.SheetData.Row[k].R] = k
}
for i := 0; i < row; i++ {
_, ok := existsRows[i+1]
@@ -167,8 +167,8 @@ func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
func (f *File) UpdateLinkedValue() {
for _, name := range f.GetSheetMap() {
xlsx := f.workSheetReader(name)
- for indexR, row := range xlsx.SheetData.Row {
- for indexC, col := range row.C {
+ for indexR := range xlsx.SheetData.Row {
+ for indexC, col := range xlsx.SheetData.Row[indexR].C {
if col.F != nil && col.V != "" {
xlsx.SheetData.Row[indexR].C[indexC].V = ""
xlsx.SheetData.Row[indexR].C[indexC].T = ""