Support workbook views Showruler settings (#1138)
This commit is contained in:
parent
862dc9dc13
commit
0f1fcb78d5
13
sheetview.go
13
sheetview.go
|
@ -60,8 +60,11 @@ type (
|
||||||
ShowZeros bool
|
ShowZeros bool
|
||||||
// View is a SheetViewOption. It specifies a flag indicating
|
// View is a SheetViewOption. It specifies a flag indicating
|
||||||
// how sheet is displayed, by default it uses empty string
|
// how sheet is displayed, by default it uses empty string
|
||||||
// available options: pageLayout, pageBreakPreview
|
// available options: normal, pageLayout, pageBreakPreview
|
||||||
View string
|
View string
|
||||||
|
// ShowRuler is a SheetViewOption. It specifies a flag indicating
|
||||||
|
// this sheet should display ruler.
|
||||||
|
ShowRuler bool
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
|
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
|
||||||
|
@ -124,6 +127,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 ShowRuler) setSheetViewOption(view *xlsxSheetView) {
|
||||||
|
view.ShowRuler = boolPtr(bool(o))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *ShowRuler) getSheetViewOption(view *xlsxSheetView) {
|
||||||
|
*o = ShowRuler(defaultTrue(view.ShowRuler)) // Excel default: true
|
||||||
|
}
|
||||||
|
|
||||||
func (o ShowZeros) setSheetViewOption(view *xlsxSheetView) {
|
func (o ShowZeros) setSheetViewOption(view *xlsxSheetView) {
|
||||||
view.ShowZeros = boolPtr(bool(o))
|
view.ShowZeros = boolPtr(bool(o))
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ var _ = []SheetViewOption{
|
||||||
ShowRowColHeaders(true),
|
ShowRowColHeaders(true),
|
||||||
TopLeftCell("B2"),
|
TopLeftCell("B2"),
|
||||||
View("pageLayout"),
|
View("pageLayout"),
|
||||||
|
ShowRuler(false),
|
||||||
// SheetViewOptionPtr are also SheetViewOption
|
// SheetViewOptionPtr are also SheetViewOption
|
||||||
new(DefaultGridColor),
|
new(DefaultGridColor),
|
||||||
new(RightToLeft),
|
new(RightToLeft),
|
||||||
|
@ -32,6 +33,7 @@ var _ = []SheetViewOptionPtr{
|
||||||
(*ShowRowColHeaders)(nil),
|
(*ShowRowColHeaders)(nil),
|
||||||
(*TopLeftCell)(nil),
|
(*TopLeftCell)(nil),
|
||||||
(*View)(nil),
|
(*View)(nil),
|
||||||
|
(*ShowRuler)(nil),
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleFile_SetSheetViewOptions() {
|
func ExampleFile_SetSheetViewOptions() {
|
||||||
|
@ -47,6 +49,7 @@ func ExampleFile_SetSheetViewOptions() {
|
||||||
ZoomScale(80),
|
ZoomScale(80),
|
||||||
TopLeftCell("C3"),
|
TopLeftCell("C3"),
|
||||||
View("pageLayout"),
|
View("pageLayout"),
|
||||||
|
ShowRuler(false),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,7 @@ type xlsxSheetView struct {
|
||||||
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"`
|
||||||
|
ShowRuler *bool `xml:"showRuler,attr,omitempty"`
|
||||||
ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
|
ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
|
||||||
ShowOutlineSymbols bool `xml:"showOutlineSymbols,attr,omitempty"`
|
ShowOutlineSymbols bool `xml:"showOutlineSymbols,attr,omitempty"`
|
||||||
DefaultGridColor *bool `xml:"defaultGridColor,attr"`
|
DefaultGridColor *bool `xml:"defaultGridColor,attr"`
|
||||||
|
|
Loading…
Reference in New Issue