From 1427027e38d6db46d441243f00d6989c2f53e7ce Mon Sep 17 00:00:00 2001 From: BluesJhao Date: Mon, 25 Feb 2019 00:29:58 +0800 Subject: Resolve #235, performance optimization for add comments (#347) --- excelize.go | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'excelize.go') diff --git a/excelize.go b/excelize.go index 32aa431..df3cd05 100644 --- a/excelize.go +++ b/excelize.go @@ -23,19 +23,22 @@ import ( // File define a populated XLSX file struct. type File struct { - checked map[string]bool - sheetMap map[string]string - CalcChain *xlsxCalcChain - ContentTypes *xlsxTypes - Path string - SharedStrings *xlsxSST - Sheet map[string]*xlsxWorksheet - SheetCount int - Styles *xlsxStyleSheet - Theme *xlsxTheme - WorkBook *xlsxWorkbook - WorkBookRels *xlsxWorkbookRels - XLSX map[string][]byte + checked map[string]bool + sheetMap map[string]string + CalcChain *xlsxCalcChain + Comments map[string]*xlsxComments + ContentTypes *xlsxTypes + Path string + SharedStrings *xlsxSST + Sheet map[string]*xlsxWorksheet + SheetCount int + Styles *xlsxStyleSheet + Theme *xlsxTheme + DecodeVMLDrawing map[string]*decodeVmlDrawing + VMLDrawing map[string]*vmlDrawing + WorkBook *xlsxWorkbook + WorkBookRels *xlsxWorkbookRels + XLSX map[string][]byte } // OpenFile take the name of an XLSX file and returns a populated XLSX file @@ -71,11 +74,15 @@ func OpenReader(r io.Reader) (*File, error) { return nil, err } f := &File{ - checked: make(map[string]bool), - Sheet: make(map[string]*xlsxWorksheet), - SheetCount: sheetCount, - XLSX: file, + checked: make(map[string]bool), + Comments: make(map[string]*xlsxComments), + Sheet: make(map[string]*xlsxWorksheet), + SheetCount: sheetCount, + DecodeVMLDrawing: make(map[string]*decodeVmlDrawing), + VMLDrawing: make(map[string]*vmlDrawing), + XLSX: file, } + f.CalcChain = f.calcChainReader() f.sheetMap = f.getSheetMap() f.Styles = f.stylesReader() f.Theme = f.themeReader() -- cgit v1.2.1