获取工作表属性
func (f *File) GetSheetPrOptions(name string, opts ...SheetPrOptionPtr) error
根据给定的工作表名称(大小写敏感)和筛选想获取工作表属性。
可选属性 | 类型 |
---|---|
CodeName | string |
EnableFormatConditionsCalculation | bool |
Published | bool |
FitToPage | bool |
AutoPageBreaks | bool |
OutlineSummaryBelow | bool |
例如:
xl := 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 := xl.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