From d2fb0197abb325ee7bbdd6576e9520c9ec8c9c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Fri, 17 Nov 2017 19:43:32 +0100 Subject: [PATCH] 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) --- sheetview.go | 1 + sheetview_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/sheetview.go b/sheetview.go index d26b8cb..f05e751 100644 --- a/sheetview.go +++ b/sheetview.go @@ -9,6 +9,7 @@ type SheetViewOption interface { // SheetViewOptionPtr is a writable SheetViewOption. See GetSheetViewOptions(). type SheetViewOptionPtr interface { + SheetViewOption getSheetViewOption(view *xlsxSheetView) } diff --git a/sheetview_test.go b/sheetview_test.go index 348b9b7..2061012 100644 --- a/sheetview_test.go +++ b/sheetview_test.go @@ -13,6 +13,12 @@ var _ = []excelize.SheetViewOption{ excelize.ShowFormulas(false), excelize.ShowGridLines(true), excelize.ShowRowColHeaders(true), + // SheetViewOptionPtr are also SheetViewOption + new(excelize.DefaultGridColor), + new(excelize.RightToLeft), + new(excelize.ShowFormulas), + new(excelize.ShowGridLines), + new(excelize.ShowRowColHeaders), } var _ = []excelize.SheetViewOptionPtr{