From 88e48e079a91191e05f32a232f8dec4454b25238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Sun, 5 Nov 2017 02:16:41 +0100 Subject: Add SetSheetViewOptions and GetSheetViewOptions (#145) Two new methods: - SetSheetViewOptions(sheetName string, viewIndex int, opts ...SheetViewOption) error - GetSheetViewOptions(sheetName string, viewIndex int, opts ...SheetViewOptionPtr) error The option values are given by the user through types that have privates methods that implement the private SheetViewOption and SheetViewOptionPtr interfaces: - DefaultGridColor(bool) - RightToLeft(bool) - ShowFormulas(bool) - ShowGridLines(bool) - ShowRowColHeaders(bool) Examples: err := xl.SetSheetViewOptions("Sheet1", -1, excelize.ShowGridLines(true)) var showGridLines excelize.ShowGridLines err := xl.GetSheetViewOptions("Sheet1", -1, &showGridLines) Fixes #145. --- xmlWorksheet.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'xmlWorksheet.go') diff --git a/xmlWorksheet.go b/xmlWorksheet.go index de7ea93..22feca8 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -145,17 +145,18 @@ type xlsxSheetViews struct { // last sheetView definition is loaded, and the others are discarded. When // multiple windows are viewing the same sheet, multiple sheetView elements // (with corresponding workbookView entries) are saved. +// See https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.sheetview.aspx type xlsxSheetView struct { WindowProtection bool `xml:"windowProtection,attr,omitempty"` ShowFormulas bool `xml:"showFormulas,attr,omitempty"` - ShowGridLines string `xml:"showGridLines,attr,omitempty"` - ShowRowColHeaders bool `xml:"showRowColHeaders,attr,omitempty"` + ShowGridLines *bool `xml:"showGridLines,attr"` + ShowRowColHeaders *bool `xml:"showRowColHeaders,attr"` ShowZeros bool `xml:"showZeros,attr,omitempty"` RightToLeft bool `xml:"rightToLeft,attr,omitempty"` TabSelected bool `xml:"tabSelected,attr,omitempty"` ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"` ShowOutlineSymbols bool `xml:"showOutlineSymbols,attr,omitempty"` - DefaultGridColor bool `xml:"defaultGridColor,attr"` + DefaultGridColor *bool `xml:"defaultGridColor,attr"` View string `xml:"view,attr,omitempty"` TopLeftCell string `xml:"topLeftCell,attr,omitempty"` ColorID int `xml:"colorId,attr,omitempty"` -- cgit v1.2.1