Skip to content

Commit

Permalink
FIX: issue extrame#47
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeilem committed Dec 3, 2018
1 parent 05a15e0 commit 032b776
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package xls
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"golang.org/x/text/encoding/charmap"
"io"
"os"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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])

Expand Down

0 comments on commit 032b776

Please sign in to comment.