@@ -39,10 +39,45 @@ func ExampleFile_SetSheetViewOptions() {
39
39
excelize .ShowFormulas (true ),
40
40
excelize .ShowGridLines (true ),
41
41
excelize .ShowRowColHeaders (true ),
42
+ excelize .ZoomScale (80 ),
42
43
); err != nil {
43
44
panic (err )
44
45
}
46
+
47
+ var zoomScale excelize.ZoomScale
48
+ fmt .Println ("Default:" )
49
+ fmt .Println ("- zoomScale: 80" )
50
+
51
+ if err := xl .SetSheetViewOptions (sheet , 0 , excelize .ZoomScale (500 )); err != nil {
52
+ panic (err )
53
+ }
54
+
55
+ if err := xl .GetSheetViewOptions (sheet , 0 , & zoomScale ); err != nil {
56
+ panic (err )
57
+ }
58
+
59
+ fmt .Println ("Used out of range value:" )
60
+ fmt .Println ("- zoomScale:" , zoomScale )
61
+
62
+ if err := xl .SetSheetViewOptions (sheet , 0 , excelize .ZoomScale (123 )); err != nil {
63
+ panic (err )
64
+ }
65
+
66
+ if err := xl .GetSheetViewOptions (sheet , 0 , & zoomScale ); err != nil {
67
+ panic (err )
68
+ }
69
+
70
+ fmt .Println ("Used correct value:" )
71
+ fmt .Println ("- zoomScale:" , zoomScale )
72
+
45
73
// Output:
74
+ // Default:
75
+ // - zoomScale: 80
76
+ // Used out of range value:
77
+ // - zoomScale: 80
78
+ // Used correct value:
79
+ // - zoomScale: 123
80
+
46
81
}
47
82
48
83
func ExampleFile_GetSheetViewOptions () {
@@ -55,6 +90,7 @@ func ExampleFile_GetSheetViewOptions() {
55
90
showFormulas excelize.ShowFormulas
56
91
showGridLines excelize.ShowGridLines
57
92
showRowColHeaders excelize.ShowRowColHeaders
93
+ zoomScale excelize.ZoomScale
58
94
)
59
95
60
96
if err := xl .GetSheetViewOptions (sheet , 0 ,
@@ -63,6 +99,7 @@ func ExampleFile_GetSheetViewOptions() {
63
99
& showFormulas ,
64
100
& showGridLines ,
65
101
& showRowColHeaders ,
102
+ & zoomScale ,
66
103
); err != nil {
67
104
panic (err )
68
105
}
@@ -73,6 +110,7 @@ func ExampleFile_GetSheetViewOptions() {
73
110
fmt .Println ("- showFormulas:" , showFormulas )
74
111
fmt .Println ("- showGridLines:" , showGridLines )
75
112
fmt .Println ("- showRowColHeaders:" , showRowColHeaders )
113
+ fmt .Println ("- zoomScale:" , zoomScale )
76
114
77
115
if err := xl .SetSheetViewOptions (sheet , 0 , excelize .ShowGridLines (false )); err != nil {
78
116
panic (err )
@@ -92,6 +130,7 @@ func ExampleFile_GetSheetViewOptions() {
92
130
// - showFormulas: false
93
131
// - showGridLines: true
94
132
// - showRowColHeaders: true
133
+ // - zoomScale: 0
95
134
// After change:
96
135
// - showGridLines: false
97
136
}
0 commit comments