From de6e075713069bd71243930756ae6f707babf44e Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Sun, 12 Mar 2017 20:38:26 +0800 Subject: Performance improvement --- styles.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'styles.go') diff --git a/styles.go b/styles.go index cac92a0..f572f84 100644 --- a/styles.go +++ b/styles.go @@ -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))) } -- cgit v1.2.1