From d591299625744fe872283b93b371d1349df25e48 Mon Sep 17 00:00:00 2001 From: "chen.s.g" Date: Mon, 11 Jun 2018 14:02:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E5=80=BC=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=A0=BC=E5=BC=8F=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- col.go | 4 ++++ format.go | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/col.go b/col.go index 1e4d76e..c3a84d2 100644 --- a/col.go +++ b/col.go @@ -180,6 +180,10 @@ func (c *NumberCol) Debug(wb *WorkBook) { } 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 { return []string{v} } diff --git a/format.go b/format.go index 58342b7..13f0434 100644 --- a/format.go +++ b/format.go @@ -121,13 +121,14 @@ func (f *Format) Prepare() { } 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], "") if f.bts > 0 { f.bts = f.bts - 1 } + } else if t := strings.Index(f.Raw[0], "General"); t > 0 { + f.bts = -1 } } }