diff options
author | Harris <mike.harris@cerner.com> | 2018-12-13 13:01:36 -0600 |
---|---|---|
committer | Harris <mike.harris@cerner.com> | 2018-12-13 14:01:57 -0600 |
commit | faa7285a4f5db13e3629360562abc8a459bad0c2 (patch) | |
tree | d8e816e6c04634a7a9e53884705198b39370bd40 /sheetpr.go | |
parent | 4094e0019f08bb771eb45ee90b1ae119c71a0f3a (diff) |
Add support to flip outline summaries
This adds outlinePr support, with the summaryBelow attribute
which defaults to true.
Closes #304
Signed-off-by: Michael Harris
Diffstat (limited to 'sheetpr.go')
-rw-r--r-- | sheetpr.go | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -31,8 +31,26 @@ type ( FitToPage bool // AutoPageBreaks is a SheetPrOption AutoPageBreaks bool + // OutlineSummaryBelow is an outlinePr, within SheetPr option + OutlineSummaryBelow bool ) +func (o OutlineSummaryBelow) setSheetPrOption(pr *xlsxSheetPr) { + if pr.OutlinePr == nil { + pr.OutlinePr = new(xlsxOutlinePr) + } + pr.OutlinePr.SummaryBelow = bool(o) +} + +func (o *OutlineSummaryBelow) getSheetPrOption(pr *xlsxSheetPr) { + // Excel default: true + if pr == nil || pr.OutlinePr == nil { + *o = true + return + } + *o = OutlineSummaryBelow(defaultTrue(&pr.OutlinePr.SummaryBelow)) +} + func (o CodeName) setSheetPrOption(pr *xlsxSheetPr) { pr.CodeName = string(o) } @@ -115,6 +133,7 @@ func (o *AutoPageBreaks) getSheetPrOption(pr *xlsxSheetPr) { // Published(bool) // FitToPage(bool) // AutoPageBreaks(bool) +// OutlineSummaryBelow(bool) func (f *File) SetSheetPrOptions(name string, opts ...SheetPrOption) error { sheet := f.workSheetReader(name) pr := sheet.SheetPr @@ -137,6 +156,7 @@ func (f *File) SetSheetPrOptions(name string, opts ...SheetPrOption) error { // Published(bool) // FitToPage(bool) // AutoPageBreaks(bool) +// OutlineSummaryBelow(bool) func (f *File) GetSheetPrOptions(name string, opts ...SheetPrOptionPtr) error { sheet := f.workSheetReader(name) pr := sheet.SheetPr |