xmlTheme.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. package excelize
  2. import "encoding/xml"
  3. // xlsxTheme directly maps the theme element in the namespace
  4. // http://schemas.openxmlformats.org/drawingml/2006/main
  5. type xlsxTheme struct {
  6. ThemeElements xlsxThemeElements `xml:"themeElements"`
  7. ObjectDefaults xlsxObjectDefaults `xml:"objectDefaults"`
  8. ExtraClrSchemeLst xlsxExtraClrSchemeLst `xml:"extraClrSchemeLst"`
  9. ExtLst *xlsxExtLst `xml:"extLst"`
  10. }
  11. // objectDefaults element allows for the definition of default shape, line,
  12. // and textbox formatting properties. An application can use this information
  13. // to format a shape (or text) initially on insertion into a document.
  14. type xlsxObjectDefaults struct {
  15. ObjectDefaults string `xml:",innerxml"`
  16. }
  17. // xlsxExtraClrSchemeLst element is a container for the list of extra color
  18. // schemes present in a document.
  19. type xlsxExtraClrSchemeLst struct {
  20. ExtraClrSchemeLst string `xml:",innerxml"`
  21. }
  22. // xlsxThemeElements directly maps the element defines the theme formatting
  23. // options for the theme and is the workhorse of the theme. This is where the
  24. // bulk of the shared theme information is contained and used by a document.
  25. // This element contains the color scheme, font scheme, and format scheme
  26. // elements which define the different formatting aspects of what a theme
  27. // defines.
  28. type xlsxThemeElements struct {
  29. ClrScheme xlsxClrScheme `xml:"clrScheme"`
  30. FontScheme xlsxFontScheme `xml:"fontScheme"`
  31. FmtScheme xlsxFmtScheme `xml:"fmtScheme"`
  32. }
  33. // xlsxClrScheme element specifies the theme color, stored in the document's
  34. // Theme part to which the value of this theme color shall be mapped. This
  35. // mapping enables multiple theme colors to be chained together.
  36. type xlsxClrScheme struct {
  37. Name string `xml:"name,attr"`
  38. Children []xlsxClrSchemeEl `xml:",any"`
  39. }
  40. // xlsxFontScheme element defines the font scheme within the theme. The font
  41. // scheme consists of a pair of major and minor fonts for which to use in a
  42. // document. The major font corresponds well with the heading areas of a
  43. // document, and the minor font corresponds well with the normal text or
  44. // paragraph areas.
  45. type xlsxFontScheme struct {
  46. Name string `xml:"name,attr"`
  47. MajorFont xlsxMajorFont `xml:"majorFont"`
  48. MinorFont xlsxMinorFont `xml:"minorFont"`
  49. ExtLst *xlsxExtLst `xml:"extLst"`
  50. }
  51. // xlsxMajorFont element defines the set of major fonts which are to be used
  52. // under different languages or locals.
  53. type xlsxMajorFont struct {
  54. Children []xlsxFontSchemeEl `xml:",any"`
  55. }
  56. // xlsxMinorFont element defines the set of minor fonts that are to be used
  57. // under different languages or locals.
  58. type xlsxMinorFont struct {
  59. Children []xlsxFontSchemeEl `xml:",any"`
  60. }
  61. // xlsxFmtScheme element contains the background fill styles, effect styles,
  62. // fill styles, and line styles which define the style matrix for a theme. The
  63. // style matrix consists of subtle, moderate, and intense fills, lines, and
  64. // effects. The background fills are not generally thought of to directly be
  65. // associated with the matrix, but do play a role in the style of the overall
  66. // document. Usually, a given object chooses a single line style, a single
  67. // fill style, and a single effect style in order to define the overall final
  68. // look of the object.
  69. type xlsxFmtScheme struct {
  70. Name string `xml:"name,attr"`
  71. FillStyleLst xlsxFillStyleLst `xml:"fillStyleLst"`
  72. LnStyleLst xlsxLnStyleLst `xml:"lnStyleLst"`
  73. EffectStyleLst xlsxEffectStyleLst `xml:"effectStyleLst"`
  74. BgFillStyleLst xlsxBgFillStyleLst `xml:"bgFillStyleLst"`
  75. }
  76. // xlsxFillStyleLst element defines a set of three fill styles that are used
  77. // within a theme. The three fill styles are arranged in order from subtle to
  78. // moderate to intense.
  79. type xlsxFillStyleLst struct {
  80. FillStyleLst string `xml:",innerxml"`
  81. }
  82. // xlsxLnStyleLst element defines a list of three line styles for use within a
  83. // theme. The three line styles are arranged in order from subtle to moderate
  84. // to intense versions of lines. This list makes up part of the style matrix.
  85. type xlsxLnStyleLst struct {
  86. LnStyleLst string `xml:",innerxml"`
  87. }
  88. // xlsxEffectStyleLst element defines a set of three effect styles that create
  89. // the effect style list for a theme. The effect styles are arranged in order
  90. // of subtle to moderate to intense.
  91. type xlsxEffectStyleLst struct {
  92. EffectStyleLst string `xml:",innerxml"`
  93. }
  94. // xlsxBgFillStyleLst element defines a list of background fills that are
  95. // used within a theme. The background fills consist of three fills, arranged
  96. // in order from subtle to moderate to intense.
  97. type xlsxBgFillStyleLst struct {
  98. BgFillStyleLst string `xml:",innerxml"`
  99. }
  100. // xlsxClrScheme maps to children of the clrScheme element in the namespace
  101. // http://schemas.openxmlformats.org/drawingml/2006/main - currently I have
  102. // not checked it for completeness - it does as much as I need.
  103. type xlsxClrSchemeEl struct {
  104. XMLName xml.Name
  105. SysClr *xlsxSysClr `xml:"sysClr"`
  106. SrgbClr *attrValString `xml:"srgbClr"`
  107. }
  108. // xlsxFontSchemeEl directly maps the major and minor font of the style's font
  109. // scheme.
  110. type xlsxFontSchemeEl struct {
  111. XMLName xml.Name
  112. Script string `xml:"script,attr,omitempty"`
  113. Typeface string `xml:"typeface,attr"`
  114. Panose string `xml:"panose,attr,omitempty"`
  115. PitchFamily string `xml:"pitchFamily,attr,omitempty"`
  116. Charset string `xml:"charset,attr,omitempty"`
  117. }
  118. // xlsxSysClr element specifies a color bound to predefined operating system
  119. // elements.
  120. type xlsxSysClr struct {
  121. Val string `xml:"val,attr"`
  122. LastClr string `xml:"lastClr,attr"`
  123. }