diff options
author | xuri <xuri.me@gmail.com> | 2021-02-16 00:02:14 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-02-16 00:02:14 +0800 |
commit | bddea1262b9219df224d19b24928d8da78a2f8c0 (patch) | |
tree | 0aa179d35adaa4ef6ae5deea59e37900d7d8cd68 /sheetpr.go | |
parent | 36b7990d6ba1036823abf7a01ec8cf74509d4910 (diff) |
This closes #785, support to change tab color; new formula function: FISHER, FISHERINV, GAMMA, GAMMALN, MIN, MINA, PERMUT
Diffstat (limited to 'sheetpr.go')
-rw-r--r-- | sheetpr.go | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -11,6 +11,8 @@ package excelize +import "strings" + // SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions(). type SheetPrOption interface { setSheetPrOption(view *xlsxSheetPr) @@ -31,6 +33,8 @@ type ( Published bool // FitToPage is a SheetPrOption FitToPage bool + // TabColor is a SheetPrOption + TabColor string // AutoPageBreaks is a SheetPrOption AutoPageBreaks bool // OutlineSummaryBelow is an outlinePr, within SheetPr option @@ -125,6 +129,28 @@ func (o *FitToPage) getSheetPrOption(pr *xlsxSheetPr) { *o = FitToPage(pr.PageSetUpPr.FitToPage) } +// setSheetPrOption implements the SheetPrOption interface and specifies a +// stable name of the sheet. +func (o TabColor) setSheetPrOption(pr *xlsxSheetPr) { + if pr.TabColor == nil { + if string(o) == "" { + return + } + pr.TabColor = new(xlsxTabColor) + } + pr.TabColor.RGB = getPaletteColor(string(o)) +} + +// getSheetPrOption implements the SheetPrOptionPtr interface and get the +// stable name of the sheet. +func (o *TabColor) getSheetPrOption(pr *xlsxSheetPr) { + if pr == nil || pr.TabColor == nil { + *o = "" + return + } + *o = TabColor(strings.TrimPrefix(pr.TabColor.RGB, "FF")) +} + // setSheetPrOption implements the SheetPrOption interface. func (o AutoPageBreaks) setSheetPrOption(pr *xlsxSheetPr) { if pr.PageSetUpPr == nil { |