summaryrefslogtreecommitdiff
path: root/cell.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-06-26 18:44:19 +0800
committerRi Xu <xuri.me@gmail.com>2017-06-26 18:44:19 +0800
commit35841caaf18b20af9e7b942ca8cbb7441f310382 (patch)
treef3ce44b34c9ed63a7af60ecbf5f999274c212b38 /cell.go
parentdb4aff04fdfdd0459f1dcf5b0540a820dd8ea34e (diff)
- Function `formattedValue()` performance improvement by avoid repeating deserialization, relate issue #64;
- Make function `ToAlphaString()` exportable, relate issue #63
Diffstat (limited to 'cell.go')
-rw-r--r--cell.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/cell.go b/cell.go
index 86c3567..0145b8e 100644
--- a/cell.go
+++ b/cell.go
@@ -70,8 +70,7 @@ func (f *File) formattedValue(s int, v string) string {
if s == 0 {
return v
}
- var styleSheet xlsxStyleSheet
- xml.Unmarshal([]byte(f.readXML("xl/styles.xml")), &styleSheet)
+ styleSheet := f.stylesReader()
ok := builtInNumFmtFunc[styleSheet.CellXfs.Xf[s].NumFmtID]
if ok != nil {
return ok(styleSheet.CellXfs.Xf[s].NumFmtID, v)
@@ -200,7 +199,7 @@ func (f *File) MergeCell(sheet, hcell, vcell string) {
if xlsx.MergeCells != nil {
mergeCell := xlsxMergeCell{}
// Correct the coordinate area, such correct C1:B3 to B1:C3.
- mergeCell.Ref = toAlphaString(hxAxis+1) + strconv.Itoa(hyAxis+1) + ":" + toAlphaString(vxAxis+1) + strconv.Itoa(vyAxis+1)
+ mergeCell.Ref = ToAlphaString(hxAxis+1) + strconv.Itoa(hyAxis+1) + ":" + ToAlphaString(vxAxis+1) + strconv.Itoa(vyAxis+1)
// Delete the merged cells of the overlapping area.
for i := 0; i < len(xlsx.MergeCells.Cells); i++ {
if checkCellInArea(hcell, xlsx.MergeCells.Cells[i].Ref) || checkCellInArea(strings.Split(xlsx.MergeCells.Cells[i].Ref, ":")[0], mergeCell.Ref) {
@@ -213,7 +212,7 @@ func (f *File) MergeCell(sheet, hcell, vcell string) {
} else {
mergeCell := xlsxMergeCell{}
// Correct the coordinate area, such correct C1:B3 to B1:C3.
- mergeCell.Ref = toAlphaString(hxAxis+1) + strconv.Itoa(hyAxis+1) + ":" + toAlphaString(vxAxis+1) + strconv.Itoa(vyAxis+1)
+ mergeCell.Ref = ToAlphaString(hxAxis+1) + strconv.Itoa(hyAxis+1) + ":" + ToAlphaString(vxAxis+1) + strconv.Itoa(vyAxis+1)
mergeCells := xlsxMergeCells{}
mergeCells.Cells = append(mergeCells.Cells, &mergeCell)
xlsx.MergeCells = &mergeCells