21
0

添加调试开关

This commit is contained in:
chen.s.g 2018-06-11 13:30:54 +08:00
parent 32d40e7b84
commit 58e631a6ed
2 changed files with 14 additions and 0 deletions

8
col.go
View File

@ -260,6 +260,10 @@ func (c *FormulaCol) String(wb *WorkBook) []string {
c.parse(wb, true) c.parse(wb, true)
} }
if wb.Debug {
fmt.Printf("formula col dump:%#+v\n", c)
}
return []string{c.value} return []string{c.value}
} }
@ -404,6 +408,10 @@ func (c *LabelsstCol) Debug(wb *WorkBook) {
} }
func (c *LabelsstCol) String(wb *WorkBook) []string { 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)]} return []string{wb.sst[int(c.Sst)]}
} }

View File

@ -10,6 +10,7 @@ import (
//xls workbook type //xls workbook type
type WorkBook struct { type WorkBook struct {
Debug bool
Is5ver bool Is5ver bool
Type uint16 Type uint16
Codepage uint16 Codepage uint16
@ -42,6 +43,11 @@ func newWorkBookFromOle2(rs io.ReadSeeker) *WorkBook {
return wb return wb
} }
// SetDebug set debug flag
func (w *WorkBook) SetDebug(debug bool) {
w.Debug = debug
}
func (w *WorkBook) parse(buf io.ReadSeeker) { func (w *WorkBook) parse(buf io.ReadSeeker) {
b := new(bof) b := new(bof)
bp := new(bof) bp := new(bof)