summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sheetview.go15
-rw-r--r--sheetview_test.go3
-rw-r--r--xmlWorksheet.go1
3 files changed, 17 insertions, 2 deletions
diff --git a/sheetview.go b/sheetview.go
index 0fb955d..5bb5aaf 100644
--- a/sheetview.go
+++ b/sheetview.go
@@ -60,9 +60,12 @@ type (
ShowZeros bool
// View is a SheetViewOption. It specifies a flag indicating
// how sheet is displayed, by default it uses empty string
- // available options: pageLayout, pageBreakPreview
+ // available options: normal, pageLayout, pageBreakPreview
View string
-
+ // ShowRuler is a SheetViewOption. It specifies a flag indicating
+ // this sheet should display ruler.
+ ShowRuler bool
+
/* TODO
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
// whether page layout view shall display margins. False means do not display
@@ -124,6 +127,14 @@ func (o *ShowGridLines) getSheetViewOption(view *xlsxSheetView) {
*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) {
view.ShowZeros = boolPtr(bool(o))
}
diff --git a/sheetview_test.go b/sheetview_test.go
index 6eb206e..cfe628d 100644
--- a/sheetview_test.go
+++ b/sheetview_test.go
@@ -15,6 +15,7 @@ var _ = []SheetViewOption{
ShowRowColHeaders(true),
TopLeftCell("B2"),
View("pageLayout"),
+ ShowRuler(false),
// SheetViewOptionPtr are also SheetViewOption
new(DefaultGridColor),
new(RightToLeft),
@@ -32,6 +33,7 @@ var _ = []SheetViewOptionPtr{
(*ShowRowColHeaders)(nil),
(*TopLeftCell)(nil),
(*View)(nil),
+ (*ShowRuler)(nil),
}
func ExampleFile_SetSheetViewOptions() {
@@ -47,6 +49,7 @@ func ExampleFile_SetSheetViewOptions() {
ZoomScale(80),
TopLeftCell("C3"),
View("pageLayout"),
+ ShowRuler(false),
); err != nil {
fmt.Println(err)
}
diff --git a/xmlWorksheet.go b/xmlWorksheet.go
index 76c6188..83dd1ba 100644
--- a/xmlWorksheet.go
+++ b/xmlWorksheet.go
@@ -191,6 +191,7 @@ type xlsxSheetView struct {
ShowZeros *bool `xml:"showZeros,attr,omitempty"`
RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
TabSelected bool `xml:"tabSelected,attr,omitempty"`
+ ShowRuler *bool `xml:"showRuler,attr,omitempty"`
ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
ShowOutlineSymbols bool `xml:"showOutlineSymbols,attr,omitempty"`
DefaultGridColor *bool `xml:"defaultGridColor,attr"`