Skip to content

Commit 506108e

Browse files
author
chen.s.g
committed
格式化及添加注释
1 parent 3952712 commit 506108e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

workbook.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
7878
wb.Type = bif.Type
7979
case 0x0042: // CODEPAGE
8080
binary.Read(item, binary.LittleEndian, &wb.Codepage)
81-
case 0x3C: // CONTINUE
82-
if pre.Id == 0xfc {
81+
case 0x003c: // SST CONTINUE identifier
82+
if pre.Id == 0x00fc {
8383
var size uint16
8484
var err error
8585
if wb.continue_utf16 >= 1 {
@@ -106,7 +106,7 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
106106
offset = offset_pre
107107
after = pre
108108
after_using = b
109-
case 0x00FC: // SST
109+
case 0x00fc: // SST identifier
110110
info := new(SstInfo)
111111
binary.Read(item, binary.LittleEndian, info)
112112
wb.sst = make([]string, info.Count)
@@ -150,7 +150,7 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
150150
f := new(FontInfo)
151151
binary.Read(item, binary.LittleEndian, f)
152152
wb.addFont(f, item)
153-
case 0x041E: //FORMAT
153+
case 0x041e: //FORMAT
154154
format := new(Format)
155155
binary.Read(item, binary.LittleEndian, &format.Head)
156156
if raw, err := wb.parseString(item, format.Head.Size); nil == err && "" != raw {
@@ -214,18 +214,24 @@ func (w *WorkBook) parseString(buf io.ReadSeeker, size uint16) (res string, err
214214
var phonetic_size = uint32(0)
215215
var flag byte
216216
err = binary.Read(buf, binary.LittleEndian, &flag)
217+
218+
// Rich-Text settings (richtext)
217219
if flag&0x8 != 0 {
218220
err = binary.Read(buf, binary.LittleEndian, &richtext_num)
219221
} else if w.continue_rich > 0 {
220222
richtext_num = w.continue_rich
221223
w.continue_rich = 0
222224
}
225+
226+
// Asian phonetic settings
223227
if flag&0x4 != 0 {
224228
err = binary.Read(buf, binary.LittleEndian, &phonetic_size)
225229
} else if w.continue_apsb > 0 {
226230
phonetic_size = w.continue_apsb
227231
w.continue_apsb = 0
228232
}
233+
234+
// Character compression
229235
if flag&0x1 != 0 {
230236
var bts = make([]uint16, size)
231237
var i = uint16(0)
@@ -253,6 +259,7 @@ func (w *WorkBook) parseString(buf io.ReadSeeker, size uint16) (res string, err
253259
runes := utf16.Decode(bts1)
254260
res = strings.Trim(string(runes), "\r\n\t ")
255261
}
262+
256263
if richtext_num > 0 {
257264
var ss int64
258265
if w.Is5ver {

0 commit comments

Comments
 (0)