forked from shakinm/xlsReader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
labelSst.go
67 lines (53 loc) · 1.32 KB
/
labelSst.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package record
import (
"github.com/chansen-p44/xlsReader/helpers"
"reflect"
)
//LABELSST: Cell Value, String Constant/SST
var LabelSStRecord = []byte{0xFD, 0x00} //(FDh)
/*
A LABELSST record describes a cell that contains a string constant from the shared
string table, which is new to BIFF8.
Record Data — BIFF8
Offset Field Name Size Contents
------------------------------------------------
4 rw 2 Row (0-based)
6 col 2 Column (0-based)
8 ixfe 2 Index to the XF record
10 isst 4 Index into the SST record where actual string is stored
*/
type LabelSSt struct {
rw [2]byte
col [2]byte
ixfe [2]byte
isst [4]byte
sst *SST
}
func (r *LabelSSt) GetRow() [2]byte {
return r.rw
}
func (r *LabelSSt) GetCol() [2]byte {
return r.col
}
func (r *LabelSSt) GetString() string {
return r.sst.Rgb[helpers.BytesToUint32(r.isst[:])].String()
}
func (r *LabelSSt) GetFloat64() (fl float64) {
return fl
}
func (r *LabelSSt) GetInt64() (in int64) {
return in
}
func (r *LabelSSt) GetType() string {
return reflect.TypeOf(r).String()
}
func (r *LabelSSt) GetXFIndex() int {
return int(helpers.BytesToUint16(r.ixfe[:]))
}
func (r *LabelSSt) Read(stream []byte, sst *SST) {
r.sst = sst
copy(r.rw[:], stream[:2])
copy(r.col[:], stream[2:4])
copy(r.ixfe[:], stream[4:6])
copy(r.isst[:], stream[6:10])
}