summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-06-29 13:28:44 +0800
committerRi Xu <xuri.me@gmail.com>2017-06-29 13:28:44 +0800
commite05867a033cabfa100e7c2b284e1f85fd4769c3c (patch)
tree2820695a09103d12d22dc75cebb8a06632f7519f /excelize.go
parent86466654e270786428540e34fd0a61e7d537a99c (diff)
Function `GetCellValue()` performance improvement by avoid repeating deserialization, relate issue #70.
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/excelize.go b/excelize.go
index f8b938c..8e91fea 100644
--- a/excelize.go
+++ b/excelize.go
@@ -15,15 +15,16 @@ import (
// File define a populated XLSX file struct.
type File struct {
- checked map[string]bool
- ContentTypes *xlsxTypes
- Path string
- Sheet map[string]*xlsxWorksheet
- SheetCount int
- Styles *xlsxStyleSheet
- WorkBook *xlsxWorkbook
- WorkBookRels *xlsxWorkbookRels
- XLSX map[string]string
+ checked map[string]bool
+ ContentTypes *xlsxTypes
+ Path string
+ SharedStrings *xlsxSST
+ Sheet map[string]*xlsxWorksheet
+ SheetCount int
+ Styles *xlsxStyleSheet
+ WorkBook *xlsxWorkbook
+ WorkBookRels *xlsxWorkbookRels
+ XLSX map[string]string
}
// OpenFile take the name of an XLSX file and returns a populated XLSX file
@@ -145,8 +146,7 @@ func (f *File) setDefaultTimeStyle(sheet, axis string) {
// deserialization by given worksheet index.
func (f *File) workSheetReader(sheet string) *xlsxWorksheet {
name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
- worksheet := f.Sheet[name]
- if worksheet == nil {
+ if f.Sheet[name] == nil {
var xlsx xlsxWorksheet
xml.Unmarshal([]byte(f.readXML(name)), &xlsx)
if f.checked == nil {
@@ -159,9 +159,8 @@ func (f *File) workSheetReader(sheet string) *xlsxWorksheet {
f.checked[name] = true
}
f.Sheet[name] = &xlsx
- worksheet = f.Sheet[name]
}
- return worksheet
+ return f.Sheet[name]
}
// SetCellInt provides function to set int type value of a cell by given