设置工作表属性
func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error
根据给定的工作表名称和筛选项设置工作表属性。
可选属性列表:
可选属性 | 类型 |
---|---|
CodeName | string |
EnableFormatConditionsCalculation | bool |
Published | bool |
FitToPage | bool |
TabColorIndexed | int |
TabColorRGB | string |
TabColorTheme | int |
TabColorTint | float64 |
AutoPageBreaks | bool |
OutlineSummaryBelow | bool |
例如:
f := excelize.NewFile()
const sheet = "Sheet1"
if err := f.SetSheetPrOptions(sheet,
excelize.CodeName("code"),
excelize.EnableFormatConditionsCalculation(false),
excelize.Published(false),
excelize.FitToPage(true),
excelize.TabColorIndexed(42),
excelize.TabColorRGB("#FFFF00"),
excelize.TabColorTheme(ColorMappingTypeLight2),
excelize.TabColorTint(0.5),
excelize.AutoPageBreaks(true),
excelize.OutlineSummaryBelow(false),
); err != nil {
fmt.Println(err)
}