修复数值通用格式格式化错误
This commit is contained in:
parent
58e631a6ed
commit
d591299625
4
col.go
4
col.go
@ -180,6 +180,10 @@ func (c *NumberCol) Debug(wb *WorkBook) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *NumberCol) String(wb *WorkBook) []string {
|
func (c *NumberCol) String(wb *WorkBook) []string {
|
||||||
|
if wb.Debug {
|
||||||
|
fmt.Printf("number col dump:%#+v\n", c)
|
||||||
|
}
|
||||||
|
|
||||||
if v, ok := wb.Format(c.Index, c.Float); ok {
|
if v, ok := wb.Format(c.Index, c.Float); ok {
|
||||||
return []string{v}
|
return []string{v}
|
||||||
}
|
}
|
||||||
|
@ -121,13 +121,14 @@ func (f *Format) Prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if TYPE_NUMERIC == f.vType || TYPE_CURRENCY == f.vType || TYPE_PERCENTAGE == f.vType {
|
if TYPE_NUMERIC == f.vType || TYPE_CURRENCY == f.vType || TYPE_PERCENTAGE == f.vType {
|
||||||
var t []string
|
if t := strings.SplitN(f.Raw[0], ".", 2); 2 == len(t) {
|
||||||
if t = strings.SplitN(f.Raw[0], ".", 2); 2 == len(t) {
|
|
||||||
f.bts = strings.Count(t[1], "")
|
f.bts = strings.Count(t[1], "")
|
||||||
|
|
||||||
if f.bts > 0 {
|
if f.bts > 0 {
|
||||||
f.bts = f.bts - 1
|
f.bts = f.bts - 1
|
||||||
}
|
}
|
||||||
|
} else if t := strings.Index(f.Raw[0], "General"); t > 0 {
|
||||||
|
f.bts = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user