21
0
Fork 0
xls/bof.go

31 lines
520 B
Go
Raw Normal View History

2015-03-19 10:39:41 +01:00
package xls
2015-03-25 04:03:05 +01:00
import (
"encoding/binary"
"io"
"unicode/utf16"
)
2015-03-19 10:39:41 +01:00
2015-09-30 04:40:01 +02:00
//the information unit in xls file
type bof struct {
2015-03-19 10:39:41 +01:00
Id uint16
Size uint16
}
2015-09-30 04:40:01 +02:00
//read the utf16 string from reader
func (b *bof) utf16String(buf io.ReadSeeker, count uint32) string {
2015-03-25 04:03:05 +01:00
var bts = make([]uint16, count)
binary.Read(buf, binary.LittleEndian, &bts)
runes := utf16.Decode(bts[:len(bts)-1])
return string(runes)
}
2015-09-30 04:40:01 +02:00
type biffHeader struct {
2015-03-19 10:39:41 +01:00
Ver uint16
Type uint16
Id_make uint16
Year uint16
Flags uint32
Min_ver uint32
}