-
Notifications
You must be signed in to change notification settings - Fork 0
/
sheet.go
84 lines (66 loc) · 2.34 KB
/
sheet.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package xlsx
import "github.com/shopspring/decimal"
// Sheet sheet operator
type Sheet interface {
// Name sheet name
Name() string
// SetCellValue set cell value
//
// Example:
// sheet.SetCellValue(1, 1, "val") // A1 => "val"
// sheet.SetCellValue(2, 3, 98.01) // B3 => 98.01
// sheet.SetCellValue(3, 1, 1000) // C1 => 1000
// sheet.SetCellValue(4, 4, time.Now()) // D4 => "2021-03-11 05:19"
SetCellValue(col, row int, value any) Cell
// SetAxisCellValue set cell value
//
// Example:
// sheet.SetAxisCellValue("A1", "val") // A1 => "val"
// sheet.SetAxisCellValue("B3", 98.01) // B3 => 98.01
// sheet.SetAxisCellValue("C1", 1000) // C1 => 1000
// sheet.SetAxisCellValue("D4", time.Now()) // D4 => "2021-03-11 05:19"
SetAxisCellValue(axis Axis, value any) Cell
// Cell get cell by cell col and row
Cell(col, row int) Cell
// AxisCell get cell by cell name
AxisCell(axis Axis) Cell
// SetColumnWidth set column width
//
// Example:
// sheet.SetColumnWidth("A:B", 20)
SetColumnWidth(columnRange string, width decimal.Decimal) Sheet
// GetColumnWidth get column width
//
// Example:
// sheet.GetColumnWidth("A") // returns 20
GetColumnWidth(columnName string) decimal.Decimal
// MergeCell merge cell
//
// Example:
// sheet.MergeCell("A1", "B1")
MergeCell(start Axis, end Axis) Sheet
// GetCellStyle get cell style
GetCellStyle(col, row int) Style
// GetAxisCellStyle get cell style
GetAxisCellStyle(axis Axis) Style
// SetCellStyle set cell style
SetCellStyle(col, row int, style Style) Sheet
// SetAxisCellStyle set cell style
SetAxisCellStyle(axis Axis, style Style) Sheet
// GetColumnStyle get column style
GetColumnStyle(col int) Style
// SetColumnStyle set column style
SetColumnStyle(col int, style Style) Sheet
// SetCellBorder set cell border
//
// Example:
// sheet.SetCellBorder(1, 1, BorderStyleThin, Color{Color: "FF0000"}, false, true, false, true)
SetCellBorder(col, row int, borderStyle BorderStyle, borderColor Color, top, right, bottom, left bool) Sheet
// SetAxisCellBorder set cell border
//
// Example:
// sheet.SetAxisCellBorder("A1", BorderStyleThin, Color{Color: "FF0000"}, false, true, false, true)
SetAxisCellBorder(axis Axis, borderStyle BorderStyle, borderColor Color, top, right, bottom, left bool) Sheet
// MaxRow get max row
MaxRow() int
}