获取工作表属性
func (f *File) GetSheetPrOptions(name string, opts ...SheetPrOptionPtr) error
根据给定的工作表名称(大小写敏感)和筛选项获取工作表属性。
可选属性 | 类型 |
---|---|
CodeName | string |
EnableFormatConditionsCalculation | bool |
Published | bool |
FitToPage | bool |
AutoPageBreaks | bool |
OutlineSummaryBelow | bool |
例如:
f := excelize.NewFile()
const sheet = "Sheet1"
var (
codeName excelize.CodeName
enableFormatConditionsCalculation excelize.EnableFormatConditionsCalculation
published excelize.Published
fitToPage excelize.FitToPage
autoPageBreaks excelize.AutoPageBreaks
outlineSummaryBelow excelize.OutlineSummaryBelow
)
if err := f.GetSheetPrOptions(sheet,
&codeName,
&enableFormatConditionsCalculation,
&published,
&fitToPage,
&autoPageBreaks,
&outlineSummaryBelow,
); err != nil {
panic(err)
}
fmt.Println("Defaults:")
fmt.Printf("- codeName: %q\n", codeName)
fmt.Println("- enableFormatConditionsCalculation:", enableFormatConditionsCalculation)
fmt.Println("- published:", published)
fmt.Println("- fitToPage:", fitToPage)
fmt.Println("- autoPageBreaks:", autoPageBreaks)
fmt.Println("- outlineSummaryBelow:", outlineSummaryBelow)
输出:
Defaults:
- codeName: ""
- enableFormatConditionsCalculation: true
- published: true
- fitToPage: false
- autoPageBreaks: false
- outlineSummaryBelow: true