summaryrefslogtreecommitdiff
path: root/sheetview_test.go
diff options
context:
space:
mode:
authorOloloevReal <nickey.n@gmail.com>2018-04-15 22:56:47 +0300
committerOloloevReal <nickey.n@gmail.com>2018-04-15 22:56:47 +0300
commit4efc3dd8f0ba956024c133277afb8ccabcf3cd47 (patch)
tree8c831a061e407dc61bbdd900780a6b66f89af316 /sheetview_test.go
parent2b97c3bb463b28e3d81f714ef55798621174e0a1 (diff)
Added ZoomScale SheetViewOption
Accessible value between 10 - 400 Used as: xlsx.SetSheetViewOptions(sheet, 0, excelize.ZoomScale(75))
Diffstat (limited to 'sheetview_test.go')
-rw-r--r--sheetview_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/sheetview_test.go b/sheetview_test.go
index 2061012..c580906 100644
--- a/sheetview_test.go
+++ b/sheetview_test.go
@@ -39,10 +39,45 @@ func ExampleFile_SetSheetViewOptions() {
excelize.ShowFormulas(true),
excelize.ShowGridLines(true),
excelize.ShowRowColHeaders(true),
+ excelize.ZoomScale(80),
); err != nil {
panic(err)
}
+
+ var zoomScale excelize.ZoomScale
+ fmt.Println("Default:")
+ fmt.Println("- zoomScale: 80")
+
+ if err := xl.SetSheetViewOptions(sheet, 0, excelize.ZoomScale(500)); err != nil {
+ panic(err)
+ }
+
+ if err := xl.GetSheetViewOptions(sheet, 0, &zoomScale); err != nil {
+ panic(err)
+ }
+
+ fmt.Println("Used out of range value:")
+ fmt.Println("- zoomScale:", zoomScale)
+
+ if err := xl.SetSheetViewOptions(sheet, 0, excelize.ZoomScale(123)); err != nil {
+ panic(err)
+ }
+
+ if err := xl.GetSheetViewOptions(sheet, 0, &zoomScale); err != nil {
+ panic(err)
+ }
+
+ fmt.Println("Used correct value:")
+ fmt.Println("- zoomScale:", zoomScale)
+
// Output:
+ // Default:
+ // - zoomScale: 80
+ // Used out of range value:
+ // - zoomScale: 80
+ // Used correct value:
+ // - zoomScale: 123
+
}
func ExampleFile_GetSheetViewOptions() {
@@ -55,6 +90,7 @@ func ExampleFile_GetSheetViewOptions() {
showFormulas excelize.ShowFormulas
showGridLines excelize.ShowGridLines
showRowColHeaders excelize.ShowRowColHeaders
+ zoomScale excelize.ZoomScale
)
if err := xl.GetSheetViewOptions(sheet, 0,
@@ -63,6 +99,7 @@ func ExampleFile_GetSheetViewOptions() {
&showFormulas,
&showGridLines,
&showRowColHeaders,
+ &zoomScale,
); err != nil {
panic(err)
}
@@ -73,6 +110,7 @@ func ExampleFile_GetSheetViewOptions() {
fmt.Println("- showFormulas:", showFormulas)
fmt.Println("- showGridLines:", showGridLines)
fmt.Println("- showRowColHeaders:", showRowColHeaders)
+ fmt.Println("- zoomScale:", zoomScale)
if err := xl.SetSheetViewOptions(sheet, 0, excelize.ShowGridLines(false)); err != nil {
panic(err)
@@ -92,6 +130,7 @@ func ExampleFile_GetSheetViewOptions() {
// - showFormulas: false
// - showGridLines: true
// - showRowColHeaders: true
+ // - zoomScale: 0
// After change:
// - showGridLines: false
}