diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-03-12 20:38:26 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-03-12 20:38:26 +0800 |
commit | de6e075713069bd71243930756ae6f707babf44e (patch) | |
tree | cc1b149da1b13dc3d4bc18712296c9b8d94e96fd /styles.go | |
parent | 5384756d6483ba4bda294d47461c8df8b25c7a9c (diff) |
Performance improvement
Diffstat (limited to 'styles.go')
-rw-r--r-- | styles.go | 18 |
1 files changed, 3 insertions, 15 deletions
@@ -196,20 +196,10 @@ func (f *File) setCellStyle(sheet, hcell, vcell string, styleID int) { hcell = toAlphaString(hxAxis+1) + strconv.Itoa(hyAxis+1) vcell = toAlphaString(vxAxis+1) + strconv.Itoa(vyAxis+1) - var xlsx xlsxWorksheet - name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml" - xml.Unmarshal([]byte(f.readXML(name)), &xlsx) - if f.checked == nil { - f.checked = make(map[string]bool) - } - ok := f.checked[name] - if !ok { - checkRow(&xlsx) - f.checked[name] = true - } + xlsx := f.workSheetReader(sheet) - completeRow(&xlsx, vxAxis+1, vyAxis+1) - completeCol(&xlsx, vxAxis+1, vyAxis+1) + completeRow(xlsx, vxAxis+1, vyAxis+1) + completeCol(xlsx, vxAxis+1, vyAxis+1) for r, row := range xlsx.SheetData.Row { for k, c := range row.C { @@ -218,6 +208,4 @@ func (f *File) setCellStyle(sheet, hcell, vcell string, styleID int) { } } } - output, _ := xml.Marshal(xlsx) - f.saveFileList(name, replaceWorkSheetsRelationshipsNameSpace(string(output))) } |