Added two exported functions `SetWorkbookPrOptions` and `GetWorkbookPrOptions` to support setting and getting the code name property of the workbook
Re-order fields of the workbook properties group to improve the compatibility
Go Modules dependencies upgrade
Put workbook related operating in new `workbook.go` source code
Library introduction docs block updated
- Add default value on getting `View` property of sheet views
- Add examples and unit test for set sheet views
- Re-order field on sheet view options
- Fix incorrect build-in number format: 42
- Simplify code for the `stylesReader` function
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)
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.