Add Formula & Format support
This commit is contained in:
29
row.go
29
row.go
@@ -2,8 +2,8 @@ package xls
|
||||
|
||||
type rowInfo struct {
|
||||
Index uint16
|
||||
Fcell uint16
|
||||
Lcell uint16
|
||||
First uint16
|
||||
Last uint16
|
||||
Height uint16
|
||||
Notused uint16
|
||||
Notused2 uint16
|
||||
@@ -20,27 +20,30 @@ type Row struct {
|
||||
//Col Get the Nth Col from the Row, if has not, return nil.
|
||||
//Suggest use Has function to test it.
|
||||
func (r *Row) Col(i int) string {
|
||||
serial := uint16(i)
|
||||
var val string
|
||||
var serial = uint16(i)
|
||||
|
||||
if ch, ok := r.cols[serial]; ok {
|
||||
strs := ch.String(r.wb)
|
||||
return strs[0]
|
||||
val = ch.String(r.wb)[0]
|
||||
} else {
|
||||
for _, v := range r.cols {
|
||||
if v.FirstCol() <= serial && v.LastCol() >= serial {
|
||||
strs := v.String(r.wb)
|
||||
return strs[serial-v.FirstCol()]
|
||||
val = v.String(r.wb)[serial-v.FirstCol()]
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//LastCol Get the number of Last Col of the Row.
|
||||
func (r *Row) LastCol() int {
|
||||
return int(r.info.Lcell)
|
||||
return val
|
||||
}
|
||||
|
||||
//FirstCol Get the number of First Col of the Row.
|
||||
func (r *Row) FirstCol() int {
|
||||
return int(r.info.Fcell)
|
||||
return int(r.info.First)
|
||||
}
|
||||
|
||||
//LastCol Get the number of Last Col of the Row.
|
||||
func (r *Row) LastCol() int {
|
||||
return int(r.info.Last)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user