Add missing ShowZeros SheetViewOption implementation
This commit is contained in:
commit
a00ba75f0f
16
sheetview.go
16
sheetview.go
|
@ -51,14 +51,18 @@ type (
|
||||||
// visible cell Location of the top left visible cell in the bottom right
|
// visible cell Location of the top left visible cell in the bottom right
|
||||||
// pane (when in Left-to-Right mode).
|
// pane (when in Left-to-Right mode).
|
||||||
TopLeftCell string
|
TopLeftCell string
|
||||||
|
// ShowZeros is a SheetViewOption. It specifies a flag indicating
|
||||||
|
// whether to "show a zero in cells that have zero value".
|
||||||
|
// When using a formula to reference another cell which is empty, the referenced value becomes 0
|
||||||
|
// when the flag is true. (Default setting is true.)
|
||||||
|
ShowZeros bool
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
|
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
|
||||||
// whether page layout view shall display margins. False means do not display
|
// whether page layout view shall display margins. False means do not display
|
||||||
// left, right, top (header), and bottom (footer) margins (even when there is
|
// left, right, top (header), and bottom (footer) margins (even when there is
|
||||||
// data in the header or footer).
|
// data in the header or footer).
|
||||||
ShowWhiteSpace bool
|
ShowWhiteSpace bool
|
||||||
// ShowZeros is a SheetViewOption.
|
|
||||||
ShowZeros bool
|
|
||||||
// WindowProtection is a SheetViewOption.
|
// WindowProtection is a SheetViewOption.
|
||||||
WindowProtection bool
|
WindowProtection bool
|
||||||
*/
|
*/
|
||||||
|
@ -106,6 +110,14 @@ func (o *ShowGridLines) getSheetViewOption(view *xlsxSheetView) {
|
||||||
*o = ShowGridLines(defaultTrue(view.ShowGridLines)) // Excel default: true
|
*o = ShowGridLines(defaultTrue(view.ShowGridLines)) // Excel default: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o ShowZeros) setSheetViewOption(view *xlsxSheetView) {
|
||||||
|
view.ShowZeros = boolPtr(bool(o))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *ShowZeros) getSheetViewOption(view *xlsxSheetView) {
|
||||||
|
*o = ShowZeros(defaultTrue(view.ShowZeros)) // Excel default: true
|
||||||
|
}
|
||||||
|
|
||||||
func (o ShowRowColHeaders) setSheetViewOption(view *xlsxSheetView) {
|
func (o ShowRowColHeaders) setSheetViewOption(view *xlsxSheetView) {
|
||||||
view.ShowRowColHeaders = boolPtr(bool(o))
|
view.ShowRowColHeaders = boolPtr(bool(o))
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ func ExampleFile_GetSheetViewOptions() {
|
||||||
rightToLeft excelize.RightToLeft
|
rightToLeft excelize.RightToLeft
|
||||||
showFormulas excelize.ShowFormulas
|
showFormulas excelize.ShowFormulas
|
||||||
showGridLines excelize.ShowGridLines
|
showGridLines excelize.ShowGridLines
|
||||||
|
showZeros excelize.ShowZeros
|
||||||
showRowColHeaders excelize.ShowRowColHeaders
|
showRowColHeaders excelize.ShowRowColHeaders
|
||||||
zoomScale excelize.ZoomScale
|
zoomScale excelize.ZoomScale
|
||||||
topLeftCell excelize.TopLeftCell
|
topLeftCell excelize.TopLeftCell
|
||||||
|
@ -105,6 +106,7 @@ func ExampleFile_GetSheetViewOptions() {
|
||||||
&rightToLeft,
|
&rightToLeft,
|
||||||
&showFormulas,
|
&showFormulas,
|
||||||
&showGridLines,
|
&showGridLines,
|
||||||
|
&showZeros,
|
||||||
&showRowColHeaders,
|
&showRowColHeaders,
|
||||||
&zoomScale,
|
&zoomScale,
|
||||||
&topLeftCell,
|
&topLeftCell,
|
||||||
|
@ -117,6 +119,7 @@ func ExampleFile_GetSheetViewOptions() {
|
||||||
fmt.Println("- rightToLeft:", rightToLeft)
|
fmt.Println("- rightToLeft:", rightToLeft)
|
||||||
fmt.Println("- showFormulas:", showFormulas)
|
fmt.Println("- showFormulas:", showFormulas)
|
||||||
fmt.Println("- showGridLines:", showGridLines)
|
fmt.Println("- showGridLines:", showGridLines)
|
||||||
|
fmt.Println("- showZeros:", showZeros)
|
||||||
fmt.Println("- showRowColHeaders:", showRowColHeaders)
|
fmt.Println("- showRowColHeaders:", showRowColHeaders)
|
||||||
fmt.Println("- zoomScale:", zoomScale)
|
fmt.Println("- zoomScale:", zoomScale)
|
||||||
fmt.Println("- topLeftCell:", `"`+topLeftCell+`"`)
|
fmt.Println("- topLeftCell:", `"`+topLeftCell+`"`)
|
||||||
|
@ -137,8 +140,17 @@ func ExampleFile_GetSheetViewOptions() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := f.SetSheetViewOptions(sheet, 0, excelize.ShowZeros(false)); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := f.GetSheetViewOptions(sheet, 0, &showZeros); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("After change:")
|
fmt.Println("After change:")
|
||||||
fmt.Println("- showGridLines:", showGridLines)
|
fmt.Println("- showGridLines:", showGridLines)
|
||||||
|
fmt.Println("- showZeros:", showZeros)
|
||||||
fmt.Println("- topLeftCell:", topLeftCell)
|
fmt.Println("- topLeftCell:", topLeftCell)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
|
@ -147,11 +159,13 @@ func ExampleFile_GetSheetViewOptions() {
|
||||||
// - rightToLeft: false
|
// - rightToLeft: false
|
||||||
// - showFormulas: false
|
// - showFormulas: false
|
||||||
// - showGridLines: true
|
// - showGridLines: true
|
||||||
|
// - showZeros: true
|
||||||
// - showRowColHeaders: true
|
// - showRowColHeaders: true
|
||||||
// - zoomScale: 0
|
// - zoomScale: 0
|
||||||
// - topLeftCell: ""
|
// - topLeftCell: ""
|
||||||
// After change:
|
// After change:
|
||||||
// - showGridLines: false
|
// - showGridLines: false
|
||||||
|
// - showZeros: false
|
||||||
// - topLeftCell: B2
|
// - topLeftCell: B2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ type xlsxSheetView struct {
|
||||||
ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
|
ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
|
||||||
ShowGridLines *bool `xml:"showGridLines,attr"`
|
ShowGridLines *bool `xml:"showGridLines,attr"`
|
||||||
ShowRowColHeaders *bool `xml:"showRowColHeaders,attr"`
|
ShowRowColHeaders *bool `xml:"showRowColHeaders,attr"`
|
||||||
ShowZeros bool `xml:"showZeros,attr,omitempty"`
|
ShowZeros *bool `xml:"showZeros,attr,omitempty"`
|
||||||
RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
|
RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
|
||||||
TabSelected bool `xml:"tabSelected,attr,omitempty"`
|
TabSelected bool `xml:"tabSelected,attr,omitempty"`
|
||||||
ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
|
ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
|
||||||
|
|
Loading…
Reference in New Issue