Support workbook views settings (#1136)
This commit is contained in:
parent
156bf6d16e
commit
862dc9dc13
12
sheetview.go
12
sheetview.go
|
@ -58,6 +58,10 @@ type (
|
|||
// 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
|
||||
// View is a SheetViewOption. It specifies a flag indicating
|
||||
// how sheet is displayed, by default it uses empty string
|
||||
// available options: pageLayout, pageBreakPreview
|
||||
View string
|
||||
|
||||
/* TODO
|
||||
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
|
||||
|
@ -80,6 +84,14 @@ func (o *TopLeftCell) getSheetViewOption(view *xlsxSheetView) {
|
|||
*o = TopLeftCell(string(view.TopLeftCell))
|
||||
}
|
||||
|
||||
func (o View) setSheetViewOption(view *xlsxSheetView) {
|
||||
view.View = string(o)
|
||||
}
|
||||
|
||||
func (o *View) getSheetViewOption(view *xlsxSheetView) {
|
||||
*o = View(string(view.View))
|
||||
}
|
||||
|
||||
func (o DefaultGridColor) setSheetViewOption(view *xlsxSheetView) {
|
||||
view.DefaultGridColor = boolPtr(bool(o))
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ var _ = []SheetViewOption{
|
|||
ShowGridLines(true),
|
||||
ShowRowColHeaders(true),
|
||||
TopLeftCell("B2"),
|
||||
View("pageLayout"),
|
||||
// SheetViewOptionPtr are also SheetViewOption
|
||||
new(DefaultGridColor),
|
||||
new(RightToLeft),
|
||||
|
@ -30,6 +31,7 @@ var _ = []SheetViewOptionPtr{
|
|||
(*ShowGridLines)(nil),
|
||||
(*ShowRowColHeaders)(nil),
|
||||
(*TopLeftCell)(nil),
|
||||
(*View)(nil),
|
||||
}
|
||||
|
||||
func ExampleFile_SetSheetViewOptions() {
|
||||
|
@ -44,6 +46,7 @@ func ExampleFile_SetSheetViewOptions() {
|
|||
ShowRowColHeaders(true),
|
||||
ZoomScale(80),
|
||||
TopLeftCell("C3"),
|
||||
View("pageLayout"),
|
||||
); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue