获取工作表属性
func (f *File) GetSheetPrOptions(sheet string, opts ...SheetPrOptionPtr) 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"
var (
codeName excelize.CodeName
enableFormatConditionsCalculation excelize.EnableFormatConditionsCalculation
published excelize.Published
fitToPage excelize.FitToPage
tabColorIndexed excelize.TabColorIndexed
tabColorRGB excelize.TabColorRGB
tabColorTheme excelize.TabColorTheme
tabColorTint excelize.TabColorTint
autoPageBreaks excelize.AutoPageBreaks
outlineSummaryBelow excelize.OutlineSummaryBelow
)
if err := f.GetSheetPrOptions(sheet,
&codeName,
&enableFormatConditionsCalculation,
&published,
&fitToPage,
&tabColorIndexed,
&tabColorRGB,
&tabColorTheme,
&tabColorTint,
&autoPageBreaks,
&outlineSummaryBelow,
); err != nil {
fmt.Println(err)
}
fmt.Println("Defaults:")
fmt.Printf("- codeName: %q\n", codeName)
fmt.Println("- enableFormatConditionsCalculation:", enableFormatConditionsCalculation)
fmt.Println("- published:", published)
fmt.Println("- fitToPage:", fitToPage)
fmt.Printf("- tabColorIndexed: %d\n", tabColorIndexed)
fmt.Printf("- tabColorRGB: %q\n", tabColorRGB)
fmt.Printf("- tabColorTheme: %d\n", tabColorTheme)
fmt.Printf("- tabColorTint: %f\n", tabColorTint)
fmt.Println("- autoPageBreaks:", autoPageBreaks)
fmt.Println("- outlineSummaryBelow:", outlineSummaryBelow)
输出:
Defaults:
- codeName: ""
- enableFormatConditionsCalculation: true
- published: true
- fitToPage: false
- tabColorIndexed: -1
- tabColorRGB: ""
- tabColorTheme: -1
- tabColorTint: 0.000000
- autoPageBreaks: false
- outlineSummaryBelow: true