xmlPivotCache.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. // Copyright 2016 - 2021 The excelize Authors. All rights reserved. Use of
  2. // this source code is governed by a BSD-style license that can be found in
  3. // the LICENSE file.
  4. //
  5. // Package excelize providing a set of functions that allow you to write to
  6. // and read from XLSX / XLSM / XLTM files. Supports reading and writing
  7. // spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports
  8. // complex components by high compatibility, and provided streaming API for
  9. // generating or reading data from a worksheet with huge amounts of data. This
  10. // library needs Go version 1.15 or later.
  11. package excelize
  12. import "encoding/xml"
  13. // xlsxPivotCacheDefinition represents the pivotCacheDefinition part. This part
  14. // defines each field in the source data, including the name, the string
  15. // resources of the instance data (for shared items), and information about
  16. // the type of data that appears in the field.
  17. type xlsxPivotCacheDefinition struct {
  18. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main pivotCacheDefinition"`
  19. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  20. Invalid bool `xml:"invalid,attr,omitempty"`
  21. SaveData bool `xml:"saveData,attr"`
  22. RefreshOnLoad bool `xml:"refreshOnLoad,attr,omitempty"`
  23. OptimizeMemory bool `xml:"optimizeMemory,attr,omitempty"`
  24. EnableRefresh bool `xml:"enableRefresh,attr,omitempty"`
  25. RefreshedBy string `xml:"refreshedBy,attr,omitempty"`
  26. RefreshedDate float64 `xml:"refreshedDate,attr,omitempty"`
  27. RefreshedDateIso float64 `xml:"refreshedDateIso,attr,omitempty"`
  28. BackgroundQuery bool `xml:"backgroundQuery,attr"`
  29. MissingItemsLimit int `xml:"missingItemsLimit,attr,omitempty"`
  30. CreatedVersion int `xml:"createdVersion,attr,omitempty"`
  31. RefreshedVersion int `xml:"refreshedVersion,attr,omitempty"`
  32. MinRefreshableVersion int `xml:"minRefreshableVersion,attr,omitempty"`
  33. RecordCount int `xml:"recordCount,attr,omitempty"`
  34. UpgradeOnRefresh bool `xml:"upgradeOnRefresh,attr,omitempty"`
  35. TupleCacheAttr bool `xml:"tupleCache,attr,omitempty"`
  36. SupportSubquery bool `xml:"supportSubquery,attr,omitempty"`
  37. SupportAdvancedDrill bool `xml:"supportAdvancedDrill,attr,omitempty"`
  38. CacheSource *xlsxCacheSource `xml:"cacheSource"`
  39. CacheFields *xlsxCacheFields `xml:"cacheFields"`
  40. CacheHierarchies *xlsxCacheHierarchies `xml:"cacheHierarchies"`
  41. Kpis *xlsxKpis `xml:"kpis"`
  42. TupleCache *xlsxTupleCache `xml:"tupleCache"`
  43. CalculatedItems *xlsxCalculatedItems `xml:"calculatedItems"`
  44. CalculatedMembers *xlsxCalculatedMembers `xml:"calculatedMembers"`
  45. Dimensions *xlsxDimensions `xml:"dimensions"`
  46. MeasureGroups *xlsxMeasureGroups `xml:"measureGroups"`
  47. Maps *xlsxMaps `xml:"maps"`
  48. ExtLst *xlsxExtLst `xml:"extLst"`
  49. }
  50. // xlsxCacheSource represents the description of data source whose data is
  51. // stored in the pivot cache. The data source refers to the underlying rows or
  52. // database records that provide the data for a PivotTable. You can create a
  53. // PivotTable report from a SpreadsheetML table, an external database
  54. // (including OLAP cubes), multiple SpreadsheetML worksheets, or another
  55. // PivotTable.
  56. type xlsxCacheSource struct {
  57. Type string `xml:"type,attr"`
  58. ConnectionID int `xml:"connectionId,attr,omitempty"`
  59. WorksheetSource *xlsxWorksheetSource `xml:"worksheetSource"`
  60. Consolidation *xlsxConsolidation `xml:"consolidation"`
  61. ExtLst *xlsxExtLst `xml:"extLst"`
  62. }
  63. // xlsxWorksheetSource represents the location of the source of the data that
  64. // is stored in the cache.
  65. type xlsxWorksheetSource struct {
  66. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  67. Ref string `xml:"ref,attr,omitempty"`
  68. Name string `xml:"name,attr,omitempty"`
  69. Sheet string `xml:"sheet,attr,omitempty"`
  70. }
  71. // xlsxConsolidation represents the description of the PivotCache source using
  72. // multiple consolidation ranges. This element is used when the source of the
  73. // PivotTable is a collection of ranges in the workbook. The ranges are
  74. // specified in the rangeSets collection. The logic for how the application
  75. // consolidates the data in the ranges is application- defined.
  76. type xlsxConsolidation struct {
  77. }
  78. // xlsxCacheFields represents the collection of field definitions in the
  79. // source data.
  80. type xlsxCacheFields struct {
  81. Count int `xml:"count,attr"`
  82. CacheField []*xlsxCacheField `xml:"cacheField"`
  83. }
  84. // xlsxCacheField represent a single field in the PivotCache. This definition
  85. // contains information about the field, such as its source, data type, and
  86. // location within a level or hierarchy. The sharedItems element stores
  87. // additional information about the data in this field. If there are no shared
  88. // items, then values are stored directly in the pivotCacheRecords part.
  89. type xlsxCacheField struct {
  90. Name string `xml:"name,attr"`
  91. Caption string `xml:"caption,attr,omitempty"`
  92. PropertyName string `xml:"propertyName,attr,omitempty"`
  93. ServerField bool `xml:"serverField,attr,omitempty"`
  94. UniqueList bool `xml:"uniqueList,attr,omitempty"`
  95. NumFmtID int `xml:"numFmtId,attr"`
  96. Formula string `xml:"formula,attr,omitempty"`
  97. SQLType int `xml:"sqlType,attr,omitempty"`
  98. Hierarchy int `xml:"hierarchy,attr,omitempty"`
  99. Level int `xml:"level,attr,omitempty"`
  100. DatabaseField bool `xml:"databaseField,attr,omitempty"`
  101. MappingCount int `xml:"mappingCount,attr,omitempty"`
  102. MemberPropertyField bool `xml:"memberPropertyField,attr,omitempty"`
  103. SharedItems *xlsxSharedItems `xml:"sharedItems"`
  104. FieldGroup *xlsxFieldGroup `xml:"fieldGroup"`
  105. MpMap *xlsxX `xml:"mpMap"`
  106. ExtLst *xlsxExtLst `xml:"extLst"`
  107. }
  108. // xlsxSharedItems represents the collection of unique items for a field in
  109. // the PivotCacheDefinition. The sharedItems complex type stores data type and
  110. // formatting information about the data in a field. Items in the
  111. // PivotCacheDefinition can be shared in order to reduce the redundancy of
  112. // those values that are referenced in multiple places across all the
  113. // PivotTable parts.
  114. type xlsxSharedItems struct {
  115. ContainsSemiMixedTypes bool `xml:"containsSemiMixedTypes,attr,omitempty"`
  116. ContainsNonDate bool `xml:"containsNonDate,attr,omitempty"`
  117. ContainsDate bool `xml:"containsDate,attr,omitempty"`
  118. ContainsString bool `xml:"containsString,attr,omitempty"`
  119. ContainsBlank bool `xml:"containsBlank,attr,omitempty"`
  120. ContainsMixedTypes bool `xml:"containsMixedTypes,attr,omitempty"`
  121. ContainsNumber bool `xml:"containsNumber,attr,omitempty"`
  122. ContainsInteger bool `xml:"containsInteger,attr,omitempty"`
  123. MinValue float64 `xml:"minValue,attr,omitempty"`
  124. MaxValue float64 `xml:"maxValue,attr,omitempty"`
  125. MinDate string `xml:"minDate,attr,omitempty"`
  126. MaxDate string `xml:"maxDate,attr,omitempty"`
  127. Count int `xml:"count,attr"`
  128. LongText bool `xml:"longText,attr,omitempty"`
  129. M *xlsxMissing `xml:"m"`
  130. N *xlsxNumber `xml:"n"`
  131. B *xlsxBoolean `xml:"b"`
  132. E *xlsxError `xml:"e"`
  133. S *xlsxString `xml:"s"`
  134. D *xlsxDateTime `xml:"d"`
  135. }
  136. // xlsxMissing represents a value that was not specified.
  137. type xlsxMissing struct {
  138. }
  139. // xlsxNumber represents a numeric value in the PivotTable.
  140. type xlsxNumber struct {
  141. V float64 `xml:"v,attr"`
  142. U bool `xml:"u,attr,omitempty"`
  143. F bool `xml:"f,attr,omitempty"`
  144. C string `xml:"c,attr,omitempty"`
  145. Cp int `xml:"cp,attr,omitempty"`
  146. In int `xml:"in,attr,omitempty"`
  147. Bc string `xml:"bc,attr,omitempty"`
  148. Fc string `xml:"fc,attr,omitempty"`
  149. I bool `xml:"i,attr,omitempty"`
  150. Un bool `xml:"un,attr,omitempty"`
  151. St bool `xml:"st,attr,omitempty"`
  152. B bool `xml:"b,attr,omitempty"`
  153. Tpls *xlsxTuples `xml:"tpls"`
  154. X *attrValInt `xml:"x"`
  155. }
  156. // xlsxTuples represents members for the OLAP sheet data entry, also known as
  157. // a tuple.
  158. type xlsxTuples struct {
  159. }
  160. // xlsxBoolean represents a boolean value for an item in the PivotTable.
  161. type xlsxBoolean struct {
  162. }
  163. // xlsxError represents an error value. The use of this item indicates that an
  164. // error value is present in the PivotTable source. The error is recorded in
  165. // the value attribute.
  166. type xlsxError struct {
  167. }
  168. // xlsxString represents a character value in a PivotTable.
  169. type xlsxString struct {
  170. V string `xml:"v,attr"`
  171. U bool `xml:"u,attr,omitempty"`
  172. F bool `xml:"f,attr,omitempty"`
  173. C string `xml:"c,attr,omitempty"`
  174. Cp int `xml:"cp,attr,omitempty"`
  175. In int `xml:"in,attr,omitempty"`
  176. Bc string `xml:"bc,attr,omitempty"`
  177. Fc string `xml:"fc,attr,omitempty"`
  178. I bool `xml:"i,attr,omitempty"`
  179. Un bool `xml:"un,attr,omitempty"`
  180. St bool `xml:"st,attr,omitempty"`
  181. B bool `xml:"b,attr,omitempty"`
  182. Tpls *xlsxTuples `xml:"tpls"`
  183. X *attrValInt `xml:"x"`
  184. }
  185. // xlsxDateTime represents a date-time value in the PivotTable.
  186. type xlsxDateTime struct {
  187. }
  188. // xlsxFieldGroup represents the collection of properties for a field group.
  189. type xlsxFieldGroup struct {
  190. }
  191. // xlsxCacheHierarchies represents the collection of OLAP hierarchies in the
  192. // PivotCache.
  193. type xlsxCacheHierarchies struct {
  194. }
  195. // xlsxKpis represents the collection of Key Performance Indicators (KPIs)
  196. // defined on the OLAP server and stored in the PivotCache.
  197. type xlsxKpis struct {
  198. }
  199. // xlsxTupleCache represents the cache of OLAP sheet data members, or tuples.
  200. type xlsxTupleCache struct {
  201. }
  202. // xlsxCalculatedItems represents the collection of calculated items.
  203. type xlsxCalculatedItems struct {
  204. }
  205. // xlsxCalculatedMembers represents the collection of calculated members in an
  206. // OLAP PivotTable.
  207. type xlsxCalculatedMembers struct {
  208. }
  209. // xlsxDimensions represents the collection of PivotTable OLAP dimensions.
  210. type xlsxDimensions struct {
  211. }
  212. // xlsxMeasureGroups represents the collection of PivotTable OLAP measure
  213. // groups.
  214. type xlsxMeasureGroups struct {
  215. }
  216. // xlsxMaps represents the PivotTable OLAP measure group - Dimension maps.
  217. type xlsxMaps struct {
  218. }