Skip to content

Commit

Permalink
添加注释,为解决部分表格中文读取乱码做准备
Browse files Browse the repository at this point in the history
  • Loading branch information
chen.s.g committed Sep 26, 2018
1 parent 506108e commit 0046d2c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
binary.Read(item, binary.LittleEndian, &wb.Codepage)
case 0x003c: // SST CONTINUE identifier
if pre.Id == 0x00fc {
var size uint16
var err error
var str string
var size uint16
if wb.continue_utf16 >= 1 {
size = wb.continue_utf16
wb.continue_utf16 = 0
} else {
err = binary.Read(item, binary.LittleEndian, &size)
}
for err == nil && offset_pre < len(wb.sst) {
var str string
if size > 0 {
str, err = wb.parseString(item, size)
wb.sst[offset_pre] = wb.sst[offset_pre] + str
Expand Down Expand Up @@ -215,23 +215,23 @@ func (w *WorkBook) parseString(buf io.ReadSeeker, size uint16) (res string, err
var flag byte
err = binary.Read(buf, binary.LittleEndian, &flag)

// Rich-Text settings (richtext)
// Rich-Text settings (richtext), 0 = Does not contain Rich-Text settings, 1 = Contains Rich-Text settings
if flag&0x8 != 0 {
err = binary.Read(buf, binary.LittleEndian, &richtext_num)
} else if w.continue_rich > 0 {
richtext_num = w.continue_rich
w.continue_rich = 0
}

// Asian phonetic settings
// Asian phonetic settings, 0 = Does not contain Asian phonetic settings, 1 = Contains Asian phonetic settings
if flag&0x4 != 0 {
err = binary.Read(buf, binary.LittleEndian, &phonetic_size)
} else if w.continue_apsb > 0 {
phonetic_size = w.continue_apsb
w.continue_apsb = 0
}

// Character compression
// Character compression, 0 = Compressed (8-bit characters), 1 = Uncompressed (16-bit characters)
if flag&0x1 != 0 {
var bts = make([]uint16, size)
var i = uint16(0)
Expand Down

0 comments on commit 0046d2c

Please sign in to comment.