diff options
Diffstat (limited to 'workbook.go')
-rw-r--r-- | workbook.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/workbook.go b/workbook.go index a2263b2..3d9fa48 100644 --- a/workbook.go +++ b/workbook.go @@ -32,6 +32,11 @@ type WorkbookPrOptionPtr interface { getWorkbookPrOption(pr *xlsxWorkbookPr) } +type ( + // FilterPrivacy is an option used for WorkbookPrOption + FilterPrivacy bool +) + // setWorkbook update workbook property of the spreadsheet. Maximum 31 // characters are allowed in sheet title. func (f *File) setWorkbook(name string, sheetID, rid int) { @@ -104,6 +109,7 @@ func (f *File) workBookWriter() { // SetWorkbookPrOptions provides a function to sets workbook properties. // // Available options: +// FilterPrivacy(bool) // CodeName(string) func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error { wb := f.workbookReader() @@ -119,6 +125,11 @@ func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error { } // setWorkbookPrOption implements the WorkbookPrOption interface. +func (o FilterPrivacy) setWorkbookPrOption(pr *xlsxWorkbookPr) { + pr.FilterPrivacy = bool(o) +} + +// setWorkbookPrOption implements the WorkbookPrOption interface. func (o CodeName) setWorkbookPrOption(pr *xlsxWorkbookPr) { pr.CodeName = string(o) } @@ -126,6 +137,7 @@ func (o CodeName) setWorkbookPrOption(pr *xlsxWorkbookPr) { // GetWorkbookPrOptions provides a function to gets workbook properties. // // Available options: +// FilterPrivacy(bool) // CodeName(string) func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error { wb := f.workbookReader() @@ -137,6 +149,16 @@ func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error { } // getWorkbookPrOption implements the WorkbookPrOption interface and get the +// filter privacy of thw workbook. +func (o *FilterPrivacy) getWorkbookPrOption(pr *xlsxWorkbookPr) { + if pr == nil { + *o = false + return + } + *o = FilterPrivacy(pr.FilterPrivacy) +} + +// getWorkbookPrOption implements the WorkbookPrOption interface and get the // code name of thw workbook. func (o *CodeName) getWorkbookPrOption(pr *xlsxWorkbookPr) { if pr == nil { |