summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2016-09-07 20:09:02 +0800
committerRi Xu <xuri.me@gmail.com>2016-09-07 20:09:02 +0800
commit0dd0fba96b8a33eb5fd365131bfc4a2361a9fe3f (patch)
treed55489640f7643bd6026e223a996f347d250652b /excelize.go
parentdf8f85d6abdebba567766484705134f30bf5f847 (diff)
Move execute checkRow logic when XLSX file open, speed up library write file.
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/excelize.go b/excelize.go
index 15710db..79f7534 100644
--- a/excelize.go
+++ b/excelize.go
@@ -27,7 +27,7 @@ func OpenFile(filename string) (*File, error) {
if err != nil {
return &File{}, err
}
- file, sheetCount, err = ReadZip(f)
+ file, sheetCount, _ = ReadZip(f)
return &File{
XLSX: file,
Path: filename,
@@ -50,7 +50,6 @@ func (f *File) SetCellInt(sheet string, axis string, value int) {
rows := xAxis + 1
cell := yAxis + 1
- xlsx = checkRow(xlsx)
xlsx = completeRow(xlsx, rows, cell)
xlsx = completeCol(xlsx, rows, cell)
@@ -79,7 +78,6 @@ func (f *File) SetCellStr(sheet string, axis string, value string) {
rows := xAxis + 1
cell := yAxis + 1
- xlsx = checkRow(xlsx)
xlsx = completeRow(xlsx, rows, cell)
xlsx = completeCol(xlsx, rows, cell)
@@ -193,7 +191,7 @@ func checkRow(xlsx xlsxWorksheet) xlsxWorksheet {
}
endR := getColIndex(v.C[lenCol-1].R)
endRow := getRowIndex(v.C[lenCol-1].R)
- endCol := titleToNumber(endR)
+ endCol := titleToNumber(endR) + 1
if lenCol < endCol {
oldRow := xlsx.SheetData.Row[k].C
xlsx.SheetData.Row[k].C = xlsx.SheetData.Row[k].C[:0]
@@ -216,9 +214,9 @@ func checkRow(xlsx xlsxWorksheet) xlsxWorksheet {
return xlsx
}
-// UpdateLinkedValue fix linked values within a spreadsheet are not updating.
-// This function will be remove value tag when met a cell have a linked value.
-// Reference https://social.technet.microsoft.com/Forums/office/en-US/e16bae1f-6a2c-4325-8013-e989a3479066/excel-2010-linked-cells-not-updating?forum=excel
+// UpdateLinkedValue fix linked values within a spreadsheet are not updating in
+// Office Excel 2007 and 2010. This function will be remove value tag when met a
+// cell have a linked value. Reference https://social.technet.microsoft.com/Forums/office/en-US/e16bae1f-6a2c-4325-8013-e989a3479066/excel-2010-linked-cells-not-updating?forum=excel
//
// Notice: after open XLSX file Excel will be update linked value and generate
// new value and will prompt save file or not.