summaryrefslogtreecommitdiff
path: root/sheetview_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'sheetview_test.go')
-rw-r--r--sheetview_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/sheetview_test.go b/sheetview_test.go
index c580906..ee81d5b 100644
--- a/sheetview_test.go
+++ b/sheetview_test.go
@@ -13,12 +13,14 @@ var _ = []excelize.SheetViewOption{
excelize.ShowFormulas(false),
excelize.ShowGridLines(true),
excelize.ShowRowColHeaders(true),
+ excelize.TopLeftCell("B2"),
// SheetViewOptionPtr are also SheetViewOption
new(excelize.DefaultGridColor),
new(excelize.RightToLeft),
new(excelize.ShowFormulas),
new(excelize.ShowGridLines),
new(excelize.ShowRowColHeaders),
+ new(excelize.TopLeftCell),
}
var _ = []excelize.SheetViewOptionPtr{
@@ -27,6 +29,7 @@ var _ = []excelize.SheetViewOptionPtr{
(*excelize.ShowFormulas)(nil),
(*excelize.ShowGridLines)(nil),
(*excelize.ShowRowColHeaders)(nil),
+ (*excelize.TopLeftCell)(nil),
}
func ExampleFile_SetSheetViewOptions() {
@@ -40,6 +43,7 @@ func ExampleFile_SetSheetViewOptions() {
excelize.ShowGridLines(true),
excelize.ShowRowColHeaders(true),
excelize.ZoomScale(80),
+ excelize.TopLeftCell("C3"),
); err != nil {
panic(err)
}
@@ -91,6 +95,7 @@ func ExampleFile_GetSheetViewOptions() {
showGridLines excelize.ShowGridLines
showRowColHeaders excelize.ShowRowColHeaders
zoomScale excelize.ZoomScale
+ topLeftCell excelize.TopLeftCell
)
if err := xl.GetSheetViewOptions(sheet, 0,
@@ -100,6 +105,7 @@ func ExampleFile_GetSheetViewOptions() {
&showGridLines,
&showRowColHeaders,
&zoomScale,
+ &topLeftCell,
); err != nil {
panic(err)
}
@@ -111,6 +117,15 @@ func ExampleFile_GetSheetViewOptions() {
fmt.Println("- showGridLines:", showGridLines)
fmt.Println("- showRowColHeaders:", showRowColHeaders)
fmt.Println("- zoomScale:", zoomScale)
+ fmt.Println("- topLeftCell:", `"`+topLeftCell+`"`)
+
+ if err := xl.SetSheetViewOptions(sheet, 0, excelize.TopLeftCell("B2")); err != nil {
+ panic(err)
+ }
+
+ if err := xl.GetSheetViewOptions(sheet, 0, &topLeftCell); err != nil {
+ panic(err)
+ }
if err := xl.SetSheetViewOptions(sheet, 0, excelize.ShowGridLines(false)); err != nil {
panic(err)
@@ -122,6 +137,7 @@ func ExampleFile_GetSheetViewOptions() {
fmt.Println("After change:")
fmt.Println("- showGridLines:", showGridLines)
+ fmt.Println("- topLeftCell:", topLeftCell)
// Output:
// Default:
@@ -131,8 +147,10 @@ func ExampleFile_GetSheetViewOptions() {
// - showGridLines: true
// - showRowColHeaders: true
// - zoomScale: 0
+ // - topLeftCell: ""
// After change:
// - showGridLines: false
+ // - topLeftCell: B2
}
func TestSheetViewOptionsErrors(t *testing.T) {