From 032b7766161fa512e97c5bb3493ddf9b833bdaca Mon Sep 17 00:00:00 2001 From: sergeilem Date: Mon, 3 Dec 2018 23:21:19 +0300 Subject: [PATCH] FIX: issue #47 --- workbook.go | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/workbook.go b/workbook.go index fd8f82d..84e4775 100644 --- a/workbook.go +++ b/workbook.go @@ -3,8 +3,6 @@ package xls import ( "bytes" "encoding/binary" - "encoding/hex" - "fmt" "golang.org/x/text/encoding/charmap" "io" "os" @@ -76,7 +74,6 @@ func (w *WorkBook) addFormat(format *Format) { } func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int) (after *bof, after_using *bof, offset int) { - fmt.Printf("BOF: %x %d ", b.Id, b.Size) after = b after_using = pre var bts = make([]byte, b.Size) @@ -108,27 +105,8 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int } for err == nil && offset_pre < len(wb.sst) { var str string - //if size > 0 { - pos2, _ := buf_item.Seek(0, io.SeekCurrent) - fmt.Printf("Pos: %x: seek: %x: ReadCONT %xh bytes into %d (%s). pre.Size: %d", - wb.pos, pos2, size, offset_pre, wb.sst[offset_pre], pre.Size) - fmt.Printf(" GetStr,size=%d ", size) str, err = wb.get_string(buf_item, size) - if len(str) > 30 { - fmt.Printf(" +strhex %s", hex.Dump([]byte(str))) - } else { - fmt.Printf(" +str %s", str) - } - if err == io.EOF { - fmt.Printf(" eof ") - } wb.sst[offset_pre] = wb.sst[offset_pre] + str - fmt.Println() - //}else{ - // err = nil - // fmt.Printf(" Add none (0-size): %d ",offset_pre) - // fmt.Println() - //} if err == io.EOF { break @@ -142,7 +120,6 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int offset = offset_pre after = pre after_using = b - fmt.Println() case 0xfc: // SST info := new(SstInfo) binary.Read(buf_item, binary.LittleEndian, info) @@ -158,14 +135,8 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int wb.pos += unsafe.Sizeof(size) if err == nil { var str string - fmt.Printf("ReadSST into %d/%d (%s)", i, info.Count, wb.sst[i]) str, err = wb.get_string(buf_item, size) - fmt.Printf(" +str %s", str) - if err == io.EOF { - fmt.Printf(" eof ") - } wb.sst[i] = wb.sst[i] + str - fmt.Println() } if err == io.EOF { @@ -224,7 +195,6 @@ func (w *WorkBook) get_string(buf io.ReadSeeker, size uint16) (res string, err e var richtext_num = uint16(0) var phonetic_size = uint32(0) var flag byte - fmt.Printf(" flag: %x ", flag) err = binary.Read(buf, binary.LittleEndian, &flag) w.pos += unsafe.Sizeof(flag) if flag&0x8 != 0 { @@ -253,9 +223,6 @@ func (w *WorkBook) get_string(buf io.ReadSeeker, size uint16) (res string, err e var runes []rune if err == io.EOF { i = i - 1 - fmt.Printf(" [runesEOF, %d, %d] ", i, size) - } else { - fmt.Printf(" [runes. %d, %d] ", i, size) } runes = utf16.Decode(bts[:i])