From 58e631a6ed6bc308baad596da4b7330f4ab8019e Mon Sep 17 00:00:00 2001 From: "chen.s.g" Date: Mon, 11 Jun 2018 13:30:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B0=83=E8=AF=95=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- col.go | 8 ++++++++ workbook.go | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/col.go b/col.go index 4ed2e20..1e4d76e 100644 --- a/col.go +++ b/col.go @@ -260,6 +260,10 @@ func (c *FormulaCol) String(wb *WorkBook) []string { c.parse(wb, true) } + if wb.Debug { + fmt.Printf("formula col dump:%#+v\n", c) + } + return []string{c.value} } @@ -404,6 +408,10 @@ func (c *LabelsstCol) Debug(wb *WorkBook) { } func (c *LabelsstCol) String(wb *WorkBook) []string { + if wb.Debug { + fmt.Println("metlabel sst col dump:", c.Sst, wb.sst[int(c.Sst)]) + } + return []string{wb.sst[int(c.Sst)]} } diff --git a/workbook.go b/workbook.go index ec2bba6..fe48bbc 100644 --- a/workbook.go +++ b/workbook.go @@ -10,6 +10,7 @@ import ( //xls workbook type type WorkBook struct { + Debug bool Is5ver bool Type uint16 Codepage uint16 @@ -42,6 +43,11 @@ func newWorkBookFromOle2(rs io.ReadSeeker) *WorkBook { return wb } +// SetDebug set debug flag +func (w *WorkBook) SetDebug(debug bool) { + w.Debug = debug +} + func (w *WorkBook) parse(buf io.ReadSeeker) { b := new(bof) bp := new(bof)