获取工作表属性

  1. func (f *File) GetSheetPrOptions(sheet string, opts ...SheetPrOptionPtr) error

根据给定的工作表名称和筛选项获取工作表属性。

可选属性类型
CodeNamestring
EnableFormatConditionsCalculationbool
Publishedbool
FitToPagebool
TabColorIndexedint
TabColorRGBstring
TabColorThemeint
TabColorTintfloat64
AutoPageBreaksbool
OutlineSummaryBelowbool

例如:

  1. f := excelize.NewFile()
  2. const sheet = "Sheet1"
  3. var (
  4. codeName excelize.CodeName
  5. enableFormatConditionsCalculation excelize.EnableFormatConditionsCalculation
  6. published excelize.Published
  7. fitToPage excelize.FitToPage
  8. tabColorIndexed excelize.TabColorIndexed
  9. tabColorRGB excelize.TabColorRGB
  10. tabColorTheme excelize.TabColorTheme
  11. tabColorTint excelize.TabColorTint
  12. autoPageBreaks excelize.AutoPageBreaks
  13. outlineSummaryBelow excelize.OutlineSummaryBelow
  14. )
  15. if err := f.GetSheetPrOptions(sheet,
  16. &codeName,
  17. &enableFormatConditionsCalculation,
  18. &published,
  19. &fitToPage,
  20. &tabColorIndexed,
  21. &tabColorRGB,
  22. &tabColorTheme,
  23. &tabColorTint,
  24. &autoPageBreaks,
  25. &outlineSummaryBelow,
  26. ); err != nil {
  27. fmt.Println(err)
  28. }
  29. fmt.Println("Defaults:")
  30. fmt.Printf("- codeName: %q\n", codeName)
  31. fmt.Println("- enableFormatConditionsCalculation:", enableFormatConditionsCalculation)
  32. fmt.Println("- published:", published)
  33. fmt.Println("- fitToPage:", fitToPage)
  34. fmt.Printf("- tabColorIndexed: %d\n", tabColorIndexed)
  35. fmt.Printf("- tabColorRGB: %q\n", tabColorRGB)
  36. fmt.Printf("- tabColorTheme: %d\n", tabColorTheme)
  37. fmt.Printf("- tabColorTint: %f\n", tabColorTint)
  38. fmt.Println("- autoPageBreaks:", autoPageBreaks)
  39. fmt.Println("- outlineSummaryBelow:", outlineSummaryBelow)

输出:

  1. Defaults:
  2. - codeName: ""
  3. - enableFormatConditionsCalculation: true
  4. - published: true
  5. - fitToPage: false
  6. - tabColorIndexed: -1
  7. - tabColorRGB: ""
  8. - tabColorTheme: -1
  9. - tabColorTint: 0.000000
  10. - autoPageBreaks: false
  11. - outlineSummaryBelow: true