github.com/shakinm/xlsReader@v0.9.12/xls/record/labelSst.go (about)

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