Skip to content

Commit d2fb019

Browse files
committed
SheetViewOptionPtr: document that it is a superset of SheetViewOption
Document in type system (not just in text for humans) that all SheetViewOptionPtr are also SheetViewOption (well, if not nil). This improves documentation visible with godoc but this simple change also allows more flexibility to manipulate SheetViewOption programatically such as saving and restoring values: var opt excelize.ShowFormulas opt = new(excelize.ShowFormulas) _ = xl.GetSheetViewOptions(sheet, -1, opt) _ = xl.SetSheetViewOptions(sheet, -1, opt)
1 parent 90998bf commit d2fb019

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

sheetview.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type SheetViewOption interface {
99

1010
// SheetViewOptionPtr is a writable SheetViewOption. See GetSheetViewOptions().
1111
type SheetViewOptionPtr interface {
12+
SheetViewOption
1213
getSheetViewOption(view *xlsxSheetView)
1314
}
1415

sheetview_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ var _ = []excelize.SheetViewOption{
1313
excelize.ShowFormulas(false),
1414
excelize.ShowGridLines(true),
1515
excelize.ShowRowColHeaders(true),
16+
// SheetViewOptionPtr are also SheetViewOption
17+
new(excelize.DefaultGridColor),
18+
new(excelize.RightToLeft),
19+
new(excelize.ShowFormulas),
20+
new(excelize.ShowGridLines),
21+
new(excelize.ShowRowColHeaders),
1622
}
1723

1824
var _ = []excelize.SheetViewOptionPtr{

0 commit comments

Comments
 (0)