diff options
Diffstat (limited to 'workbook.go')
-rw-r--r-- | workbook.go | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/workbook.go b/workbook.go index c65397b..417524b 100644 --- a/workbook.go +++ b/workbook.go @@ -33,6 +33,10 @@ type WorkbookPrOptionPtr interface { } type ( + // Date1904 is an option used for WorkbookPrOption, that indicates whether + // to use a 1900 or 1904 date system when converting serial date-times in + // the workbook to dates + Date1904 bool // FilterPrivacy is an option used for WorkbookPrOption FilterPrivacy bool ) @@ -116,6 +120,7 @@ func (f *File) workBookWriter() { // SetWorkbookPrOptions provides a function to sets workbook properties. // // Available options: +// Date1904(bool) // FilterPrivacy(bool) // CodeName(string) func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error { @@ -132,6 +137,11 @@ func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error { } // setWorkbookPrOption implements the WorkbookPrOption interface. +func (o Date1904) setWorkbookPrOption(pr *xlsxWorkbookPr) { + pr.Date1904 = bool(o) +} + +// setWorkbookPrOption implements the WorkbookPrOption interface. func (o FilterPrivacy) setWorkbookPrOption(pr *xlsxWorkbookPr) { pr.FilterPrivacy = bool(o) } @@ -144,6 +154,7 @@ func (o CodeName) setWorkbookPrOption(pr *xlsxWorkbookPr) { // GetWorkbookPrOptions provides a function to gets workbook properties. // // Available options: +// Date1904(bool) // FilterPrivacy(bool) // CodeName(string) func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error { @@ -156,7 +167,17 @@ func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error { } // getWorkbookPrOption implements the WorkbookPrOption interface and get the -// filter privacy of thw workbook. +// date1904 of the workbook. +func (o *Date1904) getWorkbookPrOption(pr *xlsxWorkbookPr) { + if pr == nil { + *o = false + return + } + *o = Date1904(pr.Date1904) +} + +// getWorkbookPrOption implements the WorkbookPrOption interface and get the +// filter privacy of the workbook. func (o *FilterPrivacy) getWorkbookPrOption(pr *xlsxWorkbookPr) { if pr == nil { *o = false @@ -166,7 +187,7 @@ func (o *FilterPrivacy) getWorkbookPrOption(pr *xlsxWorkbookPr) { } // getWorkbookPrOption implements the WorkbookPrOption interface and get the -// code name of thw workbook. +// code name of the workbook. func (o *CodeName) getWorkbookPrOption(pr *xlsxWorkbookPr) { if pr == nil { *o = "" |