summaryrefslogtreecommitdiff
path: root/rows.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-03-12 20:38:26 +0800
committerRi Xu <xuri.me@gmail.com>2017-03-12 20:38:26 +0800
commitde6e075713069bd71243930756ae6f707babf44e (patch)
treecc1b149da1b13dc3d4bc18712296c9b8d94e96fd /rows.go
parent5384756d6483ba4bda294d47461c8df8b25c7a9c (diff)
Performance improvement
Diffstat (limited to 'rows.go')
-rw-r--r--rows.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/rows.go b/rows.go
index ad33a36..b76a823 100644
--- a/rows.go
+++ b/rows.go
@@ -17,13 +17,15 @@ import (
// }
//
func (f *File) GetRows(sheet string) [][]string {
+ xlsx := f.workSheetReader(sheet)
rows := [][]string{}
name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
- decoder := xml.NewDecoder(strings.NewReader(f.readXML(name)))
- d, err := readXMLSST(f)
- if err != nil {
- return rows
+ if xlsx != nil {
+ output, _ := xml.Marshal(f.Sheet[name])
+ f.saveFileList(name, replaceWorkSheetsRelationshipsNameSpace(string(output)))
}
+ decoder := xml.NewDecoder(strings.NewReader(f.readXML(name)))
+ d, _ := readXMLSST(f)
var inElement string
var r xlsxRow
var row []string
@@ -105,20 +107,12 @@ func (f *File) getTotalRowsCols(sheet string) (int, int) {
// }
//
func (f *File) SetRowHeight(sheet string, rowIndex int, height float64) {
- xlsx := xlsxWorksheet{}
- name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
- xml.Unmarshal([]byte(f.readXML(name)), &xlsx)
-
+ xlsx := f.workSheetReader(sheet)
rows := rowIndex + 1
cells := 0
-
- completeRow(&xlsx, rows, cells)
-
+ completeRow(xlsx, rows, cells)
xlsx.SheetData.Row[rowIndex].Ht = strconv.FormatFloat(height, 'f', -1, 64)
xlsx.SheetData.Row[rowIndex].CustomHeight = true
-
- output, _ := xml.Marshal(xlsx)
- f.saveFileList(name, replaceWorkSheetsRelationshipsNameSpace(string(output)))
}
// readXMLSST read xmlSST simple function.