Skip to content

Commit 0046d2c

Browse files
author
chen.s.g
committed
添加注释,为解决部分表格中文读取乱码做准备
1 parent 506108e commit 0046d2c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: workbook.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
8080
binary.Read(item, binary.LittleEndian, &wb.Codepage)
8181
case 0x003c: // SST CONTINUE identifier
8282
if pre.Id == 0x00fc {
83-
var size uint16
8483
var err error
84+
var str string
85+
var size uint16
8586
if wb.continue_utf16 >= 1 {
8687
size = wb.continue_utf16
8788
wb.continue_utf16 = 0
8889
} else {
8990
err = binary.Read(item, binary.LittleEndian, &size)
9091
}
9192
for err == nil && offset_pre < len(wb.sst) {
92-
var str string
9393
if size > 0 {
9494
str, err = wb.parseString(item, size)
9595
wb.sst[offset_pre] = wb.sst[offset_pre] + str
@@ -215,23 +215,23 @@ func (w *WorkBook) parseString(buf io.ReadSeeker, size uint16) (res string, err
215215
var flag byte
216216
err = binary.Read(buf, binary.LittleEndian, &flag)
217217

218-
// Rich-Text settings (richtext)
218+
// Rich-Text settings (richtext), 0 = Does not contain Rich-Text settings, 1 = Contains Rich-Text settings
219219
if flag&0x8 != 0 {
220220
err = binary.Read(buf, binary.LittleEndian, &richtext_num)
221221
} else if w.continue_rich > 0 {
222222
richtext_num = w.continue_rich
223223
w.continue_rich = 0
224224
}
225225

226-
// Asian phonetic settings
226+
// Asian phonetic settings, 0 = Does not contain Asian phonetic settings, 1 = Contains Asian phonetic settings
227227
if flag&0x4 != 0 {
228228
err = binary.Read(buf, binary.LittleEndian, &phonetic_size)
229229
} else if w.continue_apsb > 0 {
230230
phonetic_size = w.continue_apsb
231231
w.continue_apsb = 0
232232
}
233233

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

0 commit comments

Comments
 (0)