summaryrefslogtreecommitdiff
path: root/numfmt.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-05-02 12:30:18 +0800
committerGitHub <noreply@github.com>2022-05-02 12:30:18 +0800
commiteed431e0fc2f61b13e7745857a41cb47d9f7f810 (patch)
tree8244e1b4749d177313e51a3d73686d16c0176451 /numfmt.go
parent773d4afa32a55349a7b178c4c76d182f9ed0221f (diff)
This closes #1219, fixes cell value reading issue, improves performance, and 1904 date system support
- Fix incorrect cell data types casting results when number formatting - Support set cell value on 1904 date system enabled, ref #1212 - Improve performance for set sheet row and the merging cells, fix performance impact when resolving #1129
Diffstat (limited to 'numfmt.go')
-rw-r--r--numfmt.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/numfmt.go b/numfmt.go
index 5503027..2052fd9 100644
--- a/numfmt.go
+++ b/numfmt.go
@@ -939,10 +939,11 @@ func (nf *numberFormat) textHandler() (result string) {
// getValueSectionType returns its applicable number format expression section
// based on the given value.
func (nf *numberFormat) getValueSectionType(value string) (float64, string) {
- number, err := strconv.ParseFloat(value, 64)
- if err != nil {
- return number, nfp.TokenSectionText
+ isNum, _ := isNumeric(value)
+ if !isNum {
+ return 0, nfp.TokenSectionText
}
+ number, _ := strconv.ParseFloat(value, 64)
if number > 0 {
return number, nfp.TokenSectionPositive
}