Skip to content

Commit

Permalink
Мелкие изменения
Browse files Browse the repository at this point in the history
  • Loading branch information
korv1982 committed Oct 23, 2017
1 parent 75efccf commit 18a6340
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"unicode/utf16"
"golang.org/x/text/encoding/charmap"
)

//xls workbook type
Expand Down Expand Up @@ -160,12 +161,17 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
}
return
}

func decodeWindows1251(enc []byte) string {
dec := charmap.Windows1251.NewDecoder()
out, _ := dec.Bytes(enc)
return string(out)
}
func (w *WorkBook) get_string(buf io.ReadSeeker, size uint16) (res string, err error) {
if w.Is5ver {
var bts = make([]byte, size)
_, err = buf.Read(bts)
res = string(bts)
res = decodeWindows1251(bts)
//res = string(bts)
} else {
var richtext_num = uint16(0)
var phonetic_size = uint32(0)
Expand Down
5 changes: 4 additions & 1 deletion xls.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ func OpenReader(reader io.ReadSeeker, charset string) (wb *WorkBook, err error)
for _, file := range dir {
name := file.Name()
if name == "Workbook" {
book = file
if book == nil {
book = file
}
//book = file
// break
}
if name == "Book" {
Expand Down

0 comments on commit 18a6340

Please sign in to comment.