diff options
author | xuri <xuri.me@gmail.com> | 2018-12-16 11:15:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-16 11:15:50 +0800 |
commit | d166d2e06fd7faf116a5d8ef9ec035a5a05799c5 (patch) | |
tree | 7e23c620706408f4265468d00afe5eda2ff2f773 /sheetpr.go | |
parent | e728ff14981bda19a18a830e416290cecc5a269e (diff) | |
parent | faa7285a4f5db13e3629360562abc8a459bad0c2 (diff) |
Merge pull request #307 from mlh758/add-outline-summary
Add support to flip outline summaries
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 |