@@ -27,74 +27,49 @@ type SheetViewOptionPtr interface {
27
27
}
28
28
29
29
type (
30
- // DefaultGridColor is a SheetViewOption. It specifies a flag indicating that
31
- // the consuming application should use the default grid lines color (system
32
- // dependent). Overrides any color specified in colorId.
30
+ // DefaultGridColor is a SheetViewOption. It specifies a flag indicating
31
+ // that the consuming application should use the default grid lines color
32
+ // (system dependent). Overrides any color specified in colorId.
33
33
DefaultGridColor bool
34
- // RightToLeft is a SheetViewOption. It specifies a flag indicating whether
35
- // the sheet is in 'right to left' display mode. When in this mode, Column A
36
- // is on the far right, Column B ;is one column left of Column A, and so on.
37
- // Also, information in cells is displayed in the Right to Left format.
38
- RightToLeft bool
39
- // ShowFormulas is a SheetViewOption. It specifies a flag indicating whether
40
- // this sheet should display formulas.
34
+ // ShowFormulas is a SheetViewOption. It specifies a flag indicating
35
+ // whether this sheet should display formulas.
41
36
ShowFormulas bool
42
- // ShowGridLines is a SheetViewOption. It specifies a flag indicating whether
43
- // this sheet should display gridlines.
37
+ // ShowGridLines is a SheetViewOption. It specifies a flag indicating
38
+ // whether this sheet should display gridlines.
44
39
ShowGridLines bool
45
40
// ShowRowColHeaders is a SheetViewOption. It specifies a flag indicating
46
41
// whether the sheet should display row and column headings.
47
42
ShowRowColHeaders bool
48
- // ZoomScale is a SheetViewOption. It specifies a window zoom magnification
49
- // for current view representing percent values. This attribute is restricted
50
- // to values ranging from 10 to 400. Horizontal & Vertical scale together.
51
- ZoomScale float64
52
- // TopLeftCell is a SheetViewOption. It specifies a location of the top left
53
- // visible cell Location of the top left visible cell in the bottom right
54
- // pane (when in Left-to-Right mode).
55
- TopLeftCell string
56
- // ShowZeros is a SheetViewOption. It specifies a flag indicating
57
- // whether to "show a zero in cells that have zero value".
58
- // When using a formula to reference another cell which is empty, the referenced value becomes 0
43
+ // ShowZeros is a SheetViewOption. It specifies a flag indicating whether
44
+ // to "show a zero in cells that have zero value". When using a formula to
45
+ // reference another cell which is empty, the referenced value becomes 0
59
46
// when the flag is true. (Default setting is true.)
60
47
ShowZeros bool
61
- // View is a SheetViewOption. It specifies a flag indicating
62
- // how sheet is displayed, by default it uses empty string
63
- // available options: normal, pageLayout, pageBreakPreview
64
- View string
65
- // ShowRuler is a SheetViewOption. It specifies a flag indicating
66
- // this sheet should display ruler.
48
+ // RightToLeft is a SheetViewOption. It specifies a flag indicating whether
49
+ // the sheet is in 'right to left' display mode. When in this mode, Column
50
+ // A is on the far right, Column B ;is one column left of Column A, and so
51
+ // on. Also, information in cells is displayed in the Right to Left format.
52
+ RightToLeft bool
53
+ // ShowRuler is a SheetViewOption. It specifies a flag indicating this
54
+ // sheet should display ruler.
67
55
ShowRuler bool
68
-
69
- /* TODO
70
- // ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
71
- // whether page layout view shall display margins. False means do not display
72
- // left, right, top (header), and bottom (footer) margins (even when there is
73
- // data in the header or footer).
74
- ShowWhiteSpace bool
75
- // WindowProtection is a SheetViewOption.
76
- WindowProtection bool
77
- */
56
+ // View is a SheetViewOption. It specifies a flag indicating how sheet is
57
+ // displayed, by default it uses empty string available options: normal,
58
+ // pageLayout, pageBreakPreview
59
+ View string
60
+ // TopLeftCell is a SheetViewOption. It specifies a location of the top
61
+ // left visible cell Location of the top left visible cell in the bottom
62
+ // right pane (when in Left-to-Right mode).
63
+ TopLeftCell string
64
+ // ZoomScale is a SheetViewOption. It specifies a window zoom magnification
65
+ // for current view representing percent values. This attribute is
66
+ // restricted to values ranging from 10 to 400. Horizontal & Vertical
67
+ // scale together.
68
+ ZoomScale float64
78
69
)
79
70
80
71
// Defaults for each option are described in XML schema for CT_SheetView
81
72
82
- func (o TopLeftCell ) setSheetViewOption (view * xlsxSheetView ) {
83
- view .TopLeftCell = string (o )
84
- }
85
-
86
- func (o * TopLeftCell ) getSheetViewOption (view * xlsxSheetView ) {
87
- * o = TopLeftCell (string (view .TopLeftCell ))
88
- }
89
-
90
- func (o View ) setSheetViewOption (view * xlsxSheetView ) {
91
- view .View = string (o )
92
- }
93
-
94
- func (o * View ) getSheetViewOption (view * xlsxSheetView ) {
95
- * o = View (string (view .View ))
96
- }
97
-
98
73
func (o DefaultGridColor ) setSheetViewOption (view * xlsxSheetView ) {
99
74
view .DefaultGridColor = boolPtr (bool (o ))
100
75
}
@@ -103,14 +78,6 @@ func (o *DefaultGridColor) getSheetViewOption(view *xlsxSheetView) {
103
78
* o = DefaultGridColor (defaultTrue (view .DefaultGridColor )) // Excel default: true
104
79
}
105
80
106
- func (o RightToLeft ) setSheetViewOption (view * xlsxSheetView ) {
107
- view .RightToLeft = bool (o ) // Excel default: false
108
- }
109
-
110
- func (o * RightToLeft ) getSheetViewOption (view * xlsxSheetView ) {
111
- * o = RightToLeft (view .RightToLeft )
112
- }
113
-
114
81
func (o ShowFormulas ) setSheetViewOption (view * xlsxSheetView ) {
115
82
view .ShowFormulas = bool (o ) // Excel default: false
116
83
}
@@ -127,12 +94,12 @@ func (o *ShowGridLines) getSheetViewOption(view *xlsxSheetView) {
127
94
* o = ShowGridLines (defaultTrue (view .ShowGridLines )) // Excel default: true
128
95
}
129
96
130
- func (o ShowRuler ) setSheetViewOption (view * xlsxSheetView ) {
131
- view .ShowRuler = boolPtr (bool (o ))
97
+ func (o ShowRowColHeaders ) setSheetViewOption (view * xlsxSheetView ) {
98
+ view .ShowRowColHeaders = boolPtr (bool (o ))
132
99
}
133
100
134
- func (o * ShowRuler ) getSheetViewOption (view * xlsxSheetView ) {
135
- * o = ShowRuler (defaultTrue (view .ShowRuler )) // Excel default: true
101
+ func (o * ShowRowColHeaders ) getSheetViewOption (view * xlsxSheetView ) {
102
+ * o = ShowRowColHeaders (defaultTrue (view .ShowRowColHeaders )) // Excel default: true
136
103
}
137
104
138
105
func (o ShowZeros ) setSheetViewOption (view * xlsxSheetView ) {
@@ -143,12 +110,40 @@ func (o *ShowZeros) getSheetViewOption(view *xlsxSheetView) {
143
110
* o = ShowZeros (defaultTrue (view .ShowZeros )) // Excel default: true
144
111
}
145
112
146
- func (o ShowRowColHeaders ) setSheetViewOption (view * xlsxSheetView ) {
147
- view .ShowRowColHeaders = boolPtr ( bool (o ))
113
+ func (o RightToLeft ) setSheetViewOption (view * xlsxSheetView ) {
114
+ view .RightToLeft = bool (o ) // Excel default: false
148
115
}
149
116
150
- func (o * ShowRowColHeaders ) getSheetViewOption (view * xlsxSheetView ) {
151
- * o = ShowRowColHeaders (defaultTrue (view .ShowRowColHeaders )) // Excel default: true
117
+ func (o * RightToLeft ) getSheetViewOption (view * xlsxSheetView ) {
118
+ * o = RightToLeft (view .RightToLeft )
119
+ }
120
+
121
+ func (o ShowRuler ) setSheetViewOption (view * xlsxSheetView ) {
122
+ view .ShowRuler = boolPtr (bool (o ))
123
+ }
124
+
125
+ func (o * ShowRuler ) getSheetViewOption (view * xlsxSheetView ) {
126
+ * o = ShowRuler (defaultTrue (view .ShowRuler )) // Excel default: true
127
+ }
128
+
129
+ func (o View ) setSheetViewOption (view * xlsxSheetView ) {
130
+ view .View = string (o )
131
+ }
132
+
133
+ func (o * View ) getSheetViewOption (view * xlsxSheetView ) {
134
+ if view .View != "" {
135
+ * o = View (view .View )
136
+ return
137
+ }
138
+ * o = View ("normal" )
139
+ }
140
+
141
+ func (o TopLeftCell ) setSheetViewOption (view * xlsxSheetView ) {
142
+ view .TopLeftCell = string (o )
143
+ }
144
+
145
+ func (o * TopLeftCell ) getSheetViewOption (view * xlsxSheetView ) {
146
+ * o = TopLeftCell (string (view .TopLeftCell ))
152
147
}
153
148
154
149
func (o ZoomScale ) setSheetViewOption (view * xlsxSheetView ) {
@@ -186,13 +181,15 @@ func (f *File) getSheetView(sheet string, viewIndex int) (*xlsxSheetView, error)
186
181
// Available options:
187
182
//
188
183
// DefaultGridColor(bool)
189
- // RightToLeft(bool)
190
184
// ShowFormulas(bool)
191
185
// ShowGridLines(bool)
192
186
// ShowRowColHeaders(bool)
193
- // ZoomScale(float64)
194
- // TopLeftCell(string)
195
187
// ShowZeros(bool)
188
+ // RightToLeft(bool)
189
+ // ShowRuler(bool)
190
+ // View(string)
191
+ // TopLeftCell(string)
192
+ // ZoomScale(float64)
196
193
//
197
194
// Example:
198
195
//
@@ -216,13 +213,15 @@ func (f *File) SetSheetViewOptions(name string, viewIndex int, opts ...SheetView
216
213
// Available options:
217
214
//
218
215
// DefaultGridColor(bool)
219
- // RightToLeft(bool)
220
216
// ShowFormulas(bool)
221
217
// ShowGridLines(bool)
222
218
// ShowRowColHeaders(bool)
223
- // ZoomScale(float64)
224
- // TopLeftCell(string)
225
219
// ShowZeros(bool)
220
+ // RightToLeft(bool)
221
+ // ShowRuler(bool)
222
+ // View(string)
223
+ // TopLeftCell(string)
224
+ // ZoomScale(float64)
226
225
//
227
226
// Example:
228
227
//
0 commit comments