-
Notifications
You must be signed in to change notification settings - Fork 0
/
cell_range.go
63 lines (53 loc) · 1.12 KB
/
cell_range.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
package xls
import (
"fmt"
)
// range type of multi rows
type Ranger interface {
FirstRow() uint16
LastRow() uint16
}
// range type of multi cells in multi rows
type CellRange struct {
FirstRowB uint16
LastRowB uint16
FristColB uint16
LastColB uint16
}
func (c *CellRange) FirstRow() uint16 {
return c.FirstRowB
}
func (c *CellRange) LastRow() uint16 {
return c.LastRowB
}
func (c *CellRange) FirstCol() uint16 {
return c.FristColB
}
func (c *CellRange) LastCol() uint16 {
return c.LastColB
}
//hyperlink type's content
type HyperLink struct {
CellRange
Description string
TextMark string
TargetFrame string
Url string
ShortedFilePath string
ExtendedFilePath string
IsUrl bool
}
//get the hyperlink string, use the public variable Url to get the original Url
func (h *HyperLink) String(wb *WorkBook) []string {
res := make([]string, h.LastColB-h.FristColB+1)
var str string
if h.IsUrl {
str = fmt.Sprintf("%s(%s)", h.Description, h.Url)
} else {
str = h.ExtendedFilePath
}
for i := uint16(0); i < h.LastColB-h.FristColB+1; i++ {
res[i] = str
}
return res
}