xmlWorksheet.go 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. // Copyright 2016 - 2023 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 and
  6. // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
  7. // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
  8. // Supports complex components by high compatibility, and provided streaming
  9. // API for generating or reading data from a worksheet with huge amounts of
  10. // data. This library needs Go version 1.16 or later.
  11. package excelize
  12. import (
  13. "encoding/xml"
  14. "sync"
  15. )
  16. // xlsxWorksheet directly maps the worksheet element in the namespace
  17. // http://schemas.openxmlformats.org/spreadsheetml/2006/main.
  18. type xlsxWorksheet struct {
  19. sync.Mutex
  20. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"`
  21. SheetPr *xlsxSheetPr `xml:"sheetPr"`
  22. Dimension *xlsxDimension `xml:"dimension"`
  23. SheetViews *xlsxSheetViews `xml:"sheetViews"`
  24. SheetFormatPr *xlsxSheetFormatPr `xml:"sheetFormatPr"`
  25. Cols *xlsxCols `xml:"cols"`
  26. SheetData xlsxSheetData `xml:"sheetData"`
  27. SheetCalcPr *xlsxInnerXML `xml:"sheetCalcPr"`
  28. SheetProtection *xlsxSheetProtection `xml:"sheetProtection"`
  29. ProtectedRanges *xlsxInnerXML `xml:"protectedRanges"`
  30. Scenarios *xlsxInnerXML `xml:"scenarios"`
  31. AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
  32. SortState *xlsxSortState `xml:"sortState"`
  33. DataConsolidate *xlsxInnerXML `xml:"dataConsolidate"`
  34. CustomSheetViews *xlsxCustomSheetViews `xml:"customSheetViews"`
  35. MergeCells *xlsxMergeCells `xml:"mergeCells"`
  36. PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"`
  37. ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"`
  38. DataValidations *xlsxDataValidations `xml:"dataValidations"`
  39. Hyperlinks *xlsxHyperlinks `xml:"hyperlinks"`
  40. PrintOptions *xlsxPrintOptions `xml:"printOptions"`
  41. PageMargins *xlsxPageMargins `xml:"pageMargins"`
  42. PageSetUp *xlsxPageSetUp `xml:"pageSetup"`
  43. HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"`
  44. RowBreaks *xlsxRowBreaks `xml:"rowBreaks"`
  45. ColBreaks *xlsxColBreaks `xml:"colBreaks"`
  46. CustomProperties *xlsxInnerXML `xml:"customProperties"`
  47. CellWatches *xlsxInnerXML `xml:"cellWatches"`
  48. IgnoredErrors *xlsxInnerXML `xml:"ignoredErrors"`
  49. SmartTags *xlsxInnerXML `xml:"smartTags"`
  50. Drawing *xlsxDrawing `xml:"drawing"`
  51. LegacyDrawing *xlsxLegacyDrawing `xml:"legacyDrawing"`
  52. LegacyDrawingHF *xlsxLegacyDrawingHF `xml:"legacyDrawingHF"`
  53. DrawingHF *xlsxDrawingHF `xml:"drawingHF"`
  54. Picture *xlsxPicture `xml:"picture"`
  55. OleObjects *xlsxInnerXML `xml:"oleObjects"`
  56. Controls *xlsxInnerXML `xml:"controls"`
  57. WebPublishItems *xlsxInnerXML `xml:"webPublishItems"`
  58. AlternateContent *xlsxAlternateContent `xml:"mc:AlternateContent"`
  59. TableParts *xlsxTableParts `xml:"tableParts"`
  60. ExtLst *xlsxExtLst `xml:"extLst"`
  61. DecodeAlternateContent *xlsxInnerXML `xml:"http://schemas.openxmlformats.org/markup-compatibility/2006 AlternateContent"`
  62. }
  63. // xlsxDrawing change r:id to rid in the namespace.
  64. type xlsxDrawing struct {
  65. XMLName xml.Name `xml:"drawing"`
  66. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  67. }
  68. // xlsxHeaderFooter directly maps the headerFooter element in the namespace
  69. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - When printed or
  70. // viewed in page layout view (§18.18.69), each page of a worksheet can have a
  71. // page header, a page footer, or both. The headers and footers on odd-numbered
  72. // pages can differ from those on even-numbered pages, and the headers and
  73. // footers on the first page can differ from those on odd- and even-numbered
  74. // pages. In the latter case, the first page is not considered an odd page.
  75. type xlsxHeaderFooter struct {
  76. XMLName xml.Name `xml:"headerFooter"`
  77. DifferentOddEven bool `xml:"differentOddEven,attr,omitempty"`
  78. DifferentFirst bool `xml:"differentFirst,attr,omitempty"`
  79. ScaleWithDoc bool `xml:"scaleWithDoc,attr,omitempty"`
  80. AlignWithMargins bool `xml:"alignWithMargins,attr,omitempty"`
  81. OddHeader string `xml:"oddHeader,omitempty"`
  82. OddFooter string `xml:"oddFooter,omitempty"`
  83. EvenHeader string `xml:"evenHeader,omitempty"`
  84. EvenFooter string `xml:"evenFooter,omitempty"`
  85. FirstHeader string `xml:"firstHeader,omitempty"`
  86. FirstFooter string `xml:"firstFooter,omitempty"`
  87. }
  88. // xlsxDrawingHF (Drawing Reference in Header Footer) specifies the usage of
  89. // drawing objects to be rendered in the headers and footers of the sheet. It
  90. // specifies an explicit relationship to the part containing the DrawingML
  91. // shapes used in the headers and footers. It also indicates where in the
  92. // headers and footers each shape belongs. One drawing object can appear in
  93. // each of the left section, center section and right section of a header and
  94. // a footer.
  95. type xlsxDrawingHF struct {
  96. Content string `xml:",innerxml"`
  97. }
  98. // xlsxPageSetUp directly maps the pageSetup element in the namespace
  99. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page setup
  100. // settings for the worksheet.
  101. type xlsxPageSetUp struct {
  102. XMLName xml.Name `xml:"pageSetup"`
  103. BlackAndWhite bool `xml:"blackAndWhite,attr,omitempty"`
  104. CellComments string `xml:"cellComments,attr,omitempty"`
  105. Copies int `xml:"copies,attr,omitempty"`
  106. Draft bool `xml:"draft,attr,omitempty"`
  107. Errors string `xml:"errors,attr,omitempty"`
  108. FirstPageNumber string `xml:"firstPageNumber,attr,omitempty"`
  109. FitToHeight *int `xml:"fitToHeight,attr"`
  110. FitToWidth *int `xml:"fitToWidth,attr"`
  111. HorizontalDPI string `xml:"horizontalDpi,attr,omitempty"`
  112. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  113. Orientation string `xml:"orientation,attr,omitempty"`
  114. PageOrder string `xml:"pageOrder,attr,omitempty"`
  115. PaperHeight string `xml:"paperHeight,attr,omitempty"`
  116. PaperSize *int `xml:"paperSize,attr"`
  117. PaperWidth string `xml:"paperWidth,attr,omitempty"`
  118. Scale int `xml:"scale,attr,omitempty"`
  119. UseFirstPageNumber bool `xml:"useFirstPageNumber,attr,omitempty"`
  120. UsePrinterDefaults bool `xml:"usePrinterDefaults,attr,omitempty"`
  121. VerticalDPI string `xml:"verticalDpi,attr,omitempty"`
  122. }
  123. // xlsxPrintOptions directly maps the printOptions element in the namespace
  124. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - Print options for
  125. // the sheet. Printer-specific settings are stored separately in the Printer
  126. // Settings part.
  127. type xlsxPrintOptions struct {
  128. XMLName xml.Name `xml:"printOptions"`
  129. GridLines bool `xml:"gridLines,attr,omitempty"`
  130. GridLinesSet bool `xml:"gridLinesSet,attr,omitempty"`
  131. Headings bool `xml:"headings,attr,omitempty"`
  132. HorizontalCentered bool `xml:"horizontalCentered,attr,omitempty"`
  133. VerticalCentered bool `xml:"verticalCentered,attr,omitempty"`
  134. }
  135. // xlsxPageMargins directly maps the pageMargins element in the namespace
  136. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page margins for
  137. // a sheet or a custom sheet view.
  138. type xlsxPageMargins struct {
  139. XMLName xml.Name `xml:"pageMargins"`
  140. Left float64 `xml:"left,attr"`
  141. Right float64 `xml:"right,attr"`
  142. Top float64 `xml:"top,attr"`
  143. Bottom float64 `xml:"bottom,attr"`
  144. Header float64 `xml:"header,attr"`
  145. Footer float64 `xml:"footer,attr"`
  146. }
  147. // xlsxSheetFormatPr directly maps the sheetFormatPr element in the namespace
  148. // http://schemas.openxmlformats.org/spreadsheetml/2006/main. This element
  149. // specifies the sheet formatting properties.
  150. type xlsxSheetFormatPr struct {
  151. XMLName xml.Name `xml:"sheetFormatPr"`
  152. BaseColWidth uint8 `xml:"baseColWidth,attr,omitempty"`
  153. DefaultColWidth float64 `xml:"defaultColWidth,attr,omitempty"`
  154. DefaultRowHeight float64 `xml:"defaultRowHeight,attr"`
  155. CustomHeight bool `xml:"customHeight,attr,omitempty"`
  156. ZeroHeight bool `xml:"zeroHeight,attr,omitempty"`
  157. ThickTop bool `xml:"thickTop,attr,omitempty"`
  158. ThickBottom bool `xml:"thickBottom,attr,omitempty"`
  159. OutlineLevelRow uint8 `xml:"outlineLevelRow,attr,omitempty"`
  160. OutlineLevelCol uint8 `xml:"outlineLevelCol,attr,omitempty"`
  161. }
  162. // xlsxSheetViews represents worksheet views collection.
  163. type xlsxSheetViews struct {
  164. XMLName xml.Name `xml:"sheetViews"`
  165. SheetView []xlsxSheetView `xml:"sheetView"`
  166. }
  167. // xlsxSheetView represents a single sheet view definition. When more than one
  168. // sheet view is defined in the file, it means that when opening the workbook,
  169. // each sheet view corresponds to a separate window within the spreadsheet
  170. // application, where each window is showing the particular sheet containing
  171. // the same workbookViewId value, the last sheetView definition is loaded, and
  172. // the others are discarded. When multiple windows are viewing the same sheet,
  173. // multiple sheetView elements (with corresponding workbookView entries) are
  174. // saved.
  175. type xlsxSheetView struct {
  176. WindowProtection bool `xml:"windowProtection,attr,omitempty"`
  177. ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
  178. ShowGridLines *bool `xml:"showGridLines,attr"`
  179. ShowRowColHeaders *bool `xml:"showRowColHeaders,attr"`
  180. ShowZeros *bool `xml:"showZeros,attr,omitempty"`
  181. RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
  182. TabSelected bool `xml:"tabSelected,attr,omitempty"`
  183. ShowRuler *bool `xml:"showRuler,attr,omitempty"`
  184. ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
  185. ShowOutlineSymbols bool `xml:"showOutlineSymbols,attr,omitempty"`
  186. DefaultGridColor *bool `xml:"defaultGridColor,attr"`
  187. View string `xml:"view,attr,omitempty"`
  188. TopLeftCell string `xml:"topLeftCell,attr,omitempty"`
  189. ColorID int `xml:"colorId,attr,omitempty"`
  190. ZoomScale float64 `xml:"zoomScale,attr,omitempty"`
  191. ZoomScaleNormal float64 `xml:"zoomScaleNormal,attr,omitempty"`
  192. ZoomScalePageLayoutView float64 `xml:"zoomScalePageLayoutView,attr,omitempty"`
  193. ZoomScaleSheetLayoutView float64 `xml:"zoomScaleSheetLayoutView,attr,omitempty"`
  194. WorkbookViewID int `xml:"workbookViewId,attr"`
  195. Pane *xlsxPane `xml:"pane,omitempty"`
  196. Selection []*xlsxSelection `xml:"selection"`
  197. }
  198. // xlsxSelection directly maps the selection element in the namespace
  199. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - Worksheet view
  200. // selection.
  201. type xlsxSelection struct {
  202. ActiveCell string `xml:"activeCell,attr,omitempty"`
  203. ActiveCellID *int `xml:"activeCellId,attr"`
  204. Pane string `xml:"pane,attr,omitempty"`
  205. SQRef string `xml:"sqref,attr,omitempty"`
  206. }
  207. // xlsxSelection directly maps the selection element. Worksheet view pane.
  208. type xlsxPane struct {
  209. ActivePane string `xml:"activePane,attr,omitempty"`
  210. State string `xml:"state,attr,omitempty"` // Either "split" or "frozen"
  211. TopLeftCell string `xml:"topLeftCell,attr,omitempty"`
  212. XSplit float64 `xml:"xSplit,attr,omitempty"`
  213. YSplit float64 `xml:"ySplit,attr,omitempty"`
  214. }
  215. // xlsxSheetPr directly maps the sheetPr element in the namespace
  216. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - Sheet-level
  217. // properties.
  218. type xlsxSheetPr struct {
  219. XMLName xml.Name `xml:"sheetPr"`
  220. SyncHorizontal bool `xml:"syncHorizontal,attr,omitempty"`
  221. SyncVertical bool `xml:"syncVertical,attr,omitempty"`
  222. SyncRef string `xml:"syncRef,attr,omitempty"`
  223. TransitionEvaluation bool `xml:"transitionEvaluation,attr,omitempty"`
  224. TransitionEntry bool `xml:"transitionEntry,attr,omitempty"`
  225. Published *bool `xml:"published,attr"`
  226. CodeName string `xml:"codeName,attr,omitempty"`
  227. FilterMode bool `xml:"filterMode,attr,omitempty"`
  228. EnableFormatConditionsCalculation *bool `xml:"enableFormatConditionsCalculation,attr"`
  229. TabColor *xlsxTabColor `xml:"tabColor"`
  230. OutlinePr *xlsxOutlinePr `xml:"outlinePr"`
  231. PageSetUpPr *xlsxPageSetUpPr `xml:"pageSetUpPr"`
  232. }
  233. // xlsxOutlinePr maps to the outlinePr element. SummaryBelow allows you to
  234. // adjust the direction of grouper controls.
  235. type xlsxOutlinePr struct {
  236. ApplyStyles *bool `xml:"applyStyles,attr"`
  237. SummaryBelow *bool `xml:"summaryBelow,attr"`
  238. SummaryRight *bool `xml:"summaryRight,attr"`
  239. ShowOutlineSymbols *bool `xml:"showOutlineSymbols,attr"`
  240. }
  241. // xlsxPageSetUpPr expresses page setup properties of the worksheet.
  242. type xlsxPageSetUpPr struct {
  243. AutoPageBreaks bool `xml:"autoPageBreaks,attr,omitempty"`
  244. FitToPage bool `xml:"fitToPage,attr,omitempty"`
  245. }
  246. // xlsxTabColor represents background color of the sheet tab.
  247. type xlsxTabColor struct {
  248. Auto bool `xml:"auto,attr,omitempty"`
  249. Indexed int `xml:"indexed,attr,omitempty"`
  250. RGB string `xml:"rgb,attr,omitempty"`
  251. Theme int `xml:"theme,attr,omitempty"`
  252. Tint float64 `xml:"tint,attr,omitempty"`
  253. }
  254. // xlsxCols defines column width and column formatting for one or more columns
  255. // of the worksheet.
  256. type xlsxCols struct {
  257. XMLName xml.Name `xml:"cols"`
  258. Col []xlsxCol `xml:"col"`
  259. }
  260. // xlsxCol directly maps the col (Column Width & Formatting). Defines column
  261. // width and column formatting for one or more columns of the worksheet.
  262. type xlsxCol struct {
  263. BestFit bool `xml:"bestFit,attr,omitempty"`
  264. Collapsed bool `xml:"collapsed,attr,omitempty"`
  265. CustomWidth bool `xml:"customWidth,attr,omitempty"`
  266. Hidden bool `xml:"hidden,attr,omitempty"`
  267. Max int `xml:"max,attr"`
  268. Min int `xml:"min,attr"`
  269. OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"`
  270. Phonetic bool `xml:"phonetic,attr,omitempty"`
  271. Style int `xml:"style,attr,omitempty"`
  272. Width *float64 `xml:"width,attr"`
  273. }
  274. // xlsxDimension directly maps the dimension element in the namespace
  275. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - This element
  276. // specifies the used range of the worksheet. It specifies the row and column
  277. // bounds of used cells in the worksheet. This is optional and is not
  278. // required. Used cells include cells with formulas, text content, and cell
  279. // formatting. When an entire column is formatted, only the first cell in that
  280. // column is considered used.
  281. type xlsxDimension struct {
  282. XMLName xml.Name `xml:"dimension"`
  283. Ref string `xml:"ref,attr"`
  284. }
  285. // xlsxSheetData collection represents the cell table itself. This collection
  286. // expresses information about each cell, grouped together by rows in the
  287. // worksheet.
  288. type xlsxSheetData struct {
  289. XMLName xml.Name `xml:"sheetData"`
  290. Row []xlsxRow `xml:"row"`
  291. }
  292. // xlsxRow directly maps the row element. The element expresses information
  293. // about an entire row of a worksheet, and contains all cell definitions for a
  294. // particular row in the worksheet.
  295. type xlsxRow struct {
  296. C []xlsxC `xml:"c"`
  297. R int `xml:"r,attr,omitempty"`
  298. Spans string `xml:"spans,attr,omitempty"`
  299. S int `xml:"s,attr,omitempty"`
  300. CustomFormat bool `xml:"customFormat,attr,omitempty"`
  301. Ht *float64 `xml:"ht,attr"`
  302. Hidden bool `xml:"hidden,attr,omitempty"`
  303. CustomHeight bool `xml:"customHeight,attr,omitempty"`
  304. OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"`
  305. Collapsed bool `xml:"collapsed,attr,omitempty"`
  306. ThickTop bool `xml:"thickTop,attr,omitempty"`
  307. ThickBot bool `xml:"thickBot,attr,omitempty"`
  308. Ph bool `xml:"ph,attr,omitempty"`
  309. }
  310. // xlsxSortState directly maps the sortState element. This collection
  311. // preserves the AutoFilter sort state.
  312. type xlsxSortState struct {
  313. ColumnSort bool `xml:"columnSort,attr,omitempty"`
  314. CaseSensitive bool `xml:"caseSensitive,attr,omitempty"`
  315. SortMethod string `xml:"sortMethod,attr,omitempty"`
  316. Ref string `xml:"ref,attr"`
  317. Content string `xml:",innerxml"`
  318. }
  319. // xlsxCustomSheetViews directly maps the customSheetViews element. This is a
  320. // collection of custom sheet views.
  321. type xlsxCustomSheetViews struct {
  322. XMLName xml.Name `xml:"customSheetViews"`
  323. CustomSheetView []*xlsxCustomSheetView `xml:"customSheetView"`
  324. }
  325. // xlsxBrk directly maps the row or column break to use when paginating a
  326. // worksheet.
  327. type xlsxBrk struct {
  328. ID int `xml:"id,attr,omitempty"`
  329. Min int `xml:"min,attr,omitempty"`
  330. Max int `xml:"max,attr,omitempty"`
  331. Man bool `xml:"man,attr,omitempty"`
  332. Pt bool `xml:"pt,attr,omitempty"`
  333. }
  334. // xlsxRowBreaks directly maps a collection of the row breaks.
  335. type xlsxRowBreaks struct {
  336. XMLName xml.Name `xml:"rowBreaks"`
  337. xlsxBreaks
  338. }
  339. // xlsxRowBreaks directly maps a collection of the column breaks.
  340. type xlsxColBreaks struct {
  341. XMLName xml.Name `xml:"colBreaks"`
  342. xlsxBreaks
  343. }
  344. // xlsxBreaks directly maps a collection of the row or column breaks.
  345. type xlsxBreaks struct {
  346. Brk []*xlsxBrk `xml:"brk"`
  347. Count int `xml:"count,attr,omitempty"`
  348. ManualBreakCount int `xml:"manualBreakCount,attr,omitempty"`
  349. }
  350. // xlsxCustomSheetView directly maps the customSheetView element.
  351. type xlsxCustomSheetView struct {
  352. Pane *xlsxPane `xml:"pane"`
  353. Selection *xlsxSelection `xml:"selection"`
  354. RowBreaks *xlsxBreaks `xml:"rowBreaks"`
  355. ColBreaks *xlsxBreaks `xml:"colBreaks"`
  356. PageMargins *xlsxPageMargins `xml:"pageMargins"`
  357. PrintOptions *xlsxPrintOptions `xml:"printOptions"`
  358. PageSetup *xlsxPageSetUp `xml:"pageSetup"`
  359. HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"`
  360. AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
  361. ExtLst *xlsxExtLst `xml:"extLst"`
  362. GUID string `xml:"guid,attr"`
  363. Scale int `xml:"scale,attr,omitempty"`
  364. ColorID int `xml:"colorId,attr,omitempty"`
  365. ShowPageBreaks bool `xml:"showPageBreaks,attr,omitempty"`
  366. ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
  367. ShowGridLines bool `xml:"showGridLines,attr,omitempty"`
  368. ShowRowCol bool `xml:"showRowCol,attr,omitempty"`
  369. OutlineSymbols bool `xml:"outlineSymbols,attr,omitempty"`
  370. ZeroValues bool `xml:"zeroValues,attr,omitempty"`
  371. FitToPage bool `xml:"fitToPage,attr,omitempty"`
  372. PrintArea bool `xml:"printArea,attr,omitempty"`
  373. Filter bool `xml:"filter,attr,omitempty"`
  374. ShowAutoFilter bool `xml:"showAutoFilter,attr,omitempty"`
  375. HiddenRows bool `xml:"hiddenRows,attr,omitempty"`
  376. HiddenColumns bool `xml:"hiddenColumns,attr,omitempty"`
  377. State string `xml:"state,attr,omitempty"`
  378. FilterUnique bool `xml:"filterUnique,attr,omitempty"`
  379. View string `xml:"view,attr,omitempty"`
  380. ShowRuler bool `xml:"showRuler,attr,omitempty"`
  381. TopLeftCell string `xml:"topLeftCell,attr,omitempty"`
  382. }
  383. // xlsxMergeCell directly maps the mergeCell element. A single merged cell.
  384. type xlsxMergeCell struct {
  385. Ref string `xml:"ref,attr,omitempty"`
  386. rect []int
  387. }
  388. // xlsxMergeCells directly maps the mergeCells element. This collection
  389. // expresses all the merged cells in the sheet.
  390. type xlsxMergeCells struct {
  391. XMLName xml.Name `xml:"mergeCells"`
  392. Count int `xml:"count,attr,omitempty"`
  393. Cells []*xlsxMergeCell `xml:"mergeCell,omitempty"`
  394. }
  395. // xlsxDataValidations expresses all data validation information for cells in a
  396. // sheet which have data validation features applied.
  397. type xlsxDataValidations struct {
  398. XMLName xml.Name `xml:"dataValidations"`
  399. Count int `xml:"count,attr,omitempty"`
  400. DisablePrompts bool `xml:"disablePrompts,attr,omitempty"`
  401. XWindow int `xml:"xWindow,attr,omitempty"`
  402. YWindow int `xml:"yWindow,attr,omitempty"`
  403. DataValidation []*DataValidation `xml:"dataValidation"`
  404. }
  405. // DataValidation directly maps the a single item of data validation defined
  406. // on a range of the worksheet.
  407. type DataValidation struct {
  408. AllowBlank bool `xml:"allowBlank,attr"`
  409. Error *string `xml:"error,attr"`
  410. ErrorStyle *string `xml:"errorStyle,attr"`
  411. ErrorTitle *string `xml:"errorTitle,attr"`
  412. Operator string `xml:"operator,attr,omitempty"`
  413. Prompt *string `xml:"prompt,attr"`
  414. PromptTitle *string `xml:"promptTitle,attr"`
  415. ShowDropDown bool `xml:"showDropDown,attr,omitempty"`
  416. ShowErrorMessage bool `xml:"showErrorMessage,attr,omitempty"`
  417. ShowInputMessage bool `xml:"showInputMessage,attr,omitempty"`
  418. Sqref string `xml:"sqref,attr"`
  419. Type string `xml:"type,attr,omitempty"`
  420. Formula1 string `xml:",innerxml"`
  421. Formula2 string `xml:",innerxml"`
  422. }
  423. // xlsxC collection represents a cell in the worksheet. Information about the
  424. // cell's location (reference), value, data type, formatting, and formula is
  425. // expressed here.
  426. //
  427. // This simple type is restricted to the values listed in the following table:
  428. //
  429. // Enumeration Value | Description
  430. // ---------------------------+---------------------------------
  431. // b (Boolean) | Cell containing a boolean.
  432. // d (Date) | Cell contains a date in the ISO 8601 format.
  433. // e (Error) | Cell containing an error.
  434. // inlineStr (Inline String) | Cell containing an (inline) rich string, i.e.,
  435. // | one not in the shared string table. If this
  436. // | cell type is used, then the cell value is in
  437. // | the is element rather than the v element in
  438. // | the cell (c element).
  439. // n (Number) | Cell containing a number.
  440. // s (Shared String) | Cell containing a shared string.
  441. // str (String) | Cell containing a formula string.
  442. type xlsxC struct {
  443. XMLName xml.Name `xml:"c"`
  444. XMLSpace xml.Attr `xml:"space,attr,omitempty"`
  445. R string `xml:"r,attr,omitempty"` // Cell ID, e.g. A1
  446. S int `xml:"s,attr,omitempty"` // Style reference
  447. T string `xml:"t,attr,omitempty"` // Type
  448. Cm *uint `xml:"cm,attr"`
  449. Vm *uint `xml:"vm,attr"`
  450. Ph *bool `xml:"ph,attr"`
  451. F *xlsxF `xml:"f"` // Formula
  452. V string `xml:"v,omitempty"` // Value
  453. IS *xlsxSI `xml:"is"`
  454. }
  455. // xlsxF represents a formula for the cell. The formula expression is
  456. // contained in the character node of this element.
  457. type xlsxF struct {
  458. Content string `xml:",chardata"`
  459. T string `xml:"t,attr,omitempty"` // Formula type
  460. Aca bool `xml:"aca,attr,omitempty"`
  461. Ref string `xml:"ref,attr,omitempty"` // Shared formula ref
  462. Dt2D bool `xml:"dt2D,attr,omitempty"`
  463. Dtr bool `xml:"dtr,attr,omitempty"`
  464. Del1 bool `xml:"del1,attr,omitempty"`
  465. Del2 bool `xml:"del2,attr,omitempty"`
  466. R1 string `xml:"r1,attr,omitempty"`
  467. R2 string `xml:"r2,attr,omitempty"`
  468. Ca bool `xml:"ca,attr,omitempty"`
  469. Si *int `xml:"si,attr"` // Shared formula index
  470. Bx bool `xml:"bx,attr,omitempty"`
  471. }
  472. // xlsxSheetProtection collection expresses the sheet protection options to
  473. // enforce when the sheet is protected.
  474. type xlsxSheetProtection struct {
  475. XMLName xml.Name `xml:"sheetProtection"`
  476. AlgorithmName string `xml:"algorithmName,attr,omitempty"`
  477. Password string `xml:"password,attr,omitempty"`
  478. HashValue string `xml:"hashValue,attr,omitempty"`
  479. SaltValue string `xml:"saltValue,attr,omitempty"`
  480. SpinCount int `xml:"spinCount,attr,omitempty"`
  481. Sheet bool `xml:"sheet,attr"`
  482. Objects bool `xml:"objects,attr"`
  483. Scenarios bool `xml:"scenarios,attr"`
  484. FormatCells bool `xml:"formatCells,attr"`
  485. FormatColumns bool `xml:"formatColumns,attr"`
  486. FormatRows bool `xml:"formatRows,attr"`
  487. InsertColumns bool `xml:"insertColumns,attr"`
  488. InsertRows bool `xml:"insertRows,attr"`
  489. InsertHyperlinks bool `xml:"insertHyperlinks,attr"`
  490. DeleteColumns bool `xml:"deleteColumns,attr"`
  491. DeleteRows bool `xml:"deleteRows,attr"`
  492. SelectLockedCells bool `xml:"selectLockedCells,attr"`
  493. Sort bool `xml:"sort,attr"`
  494. AutoFilter bool `xml:"autoFilter,attr"`
  495. PivotTables bool `xml:"pivotTables,attr"`
  496. SelectUnlockedCells bool `xml:"selectUnlockedCells,attr"`
  497. }
  498. // xlsxPhoneticPr (Phonetic Properties) represents a collection of phonetic
  499. // properties that affect the display of phonetic text for this String Item
  500. // (si). Phonetic text is used to give hints as to the pronunciation of an East
  501. // Asian language, and the hints are displayed as text within the spreadsheet
  502. // cells across the top portion of the cell. Since the phonetic hints are text,
  503. // every phonetic hint is expressed as a phonetic run (rPh), and these
  504. // properties specify how to display that phonetic run.
  505. type xlsxPhoneticPr struct {
  506. XMLName xml.Name `xml:"phoneticPr"`
  507. Alignment string `xml:"alignment,attr,omitempty"`
  508. FontID *int `xml:"fontId,attr"`
  509. Type string `xml:"type,attr,omitempty"`
  510. }
  511. // A Conditional Format is a format, such as cell shading or font color, that a
  512. // spreadsheet application can automatically apply to cells if a specified
  513. // condition is true. This collection expresses conditional formatting rules
  514. // applied to a particular cell or range.
  515. type xlsxConditionalFormatting struct {
  516. XMLName xml.Name `xml:"conditionalFormatting"`
  517. Pivot bool `xml:"pivot,attr,omitempty"`
  518. SQRef string `xml:"sqref,attr,omitempty"`
  519. CfRule []*xlsxCfRule `xml:"cfRule"`
  520. }
  521. // xlsxCfRule (Conditional Formatting Rule) represents a description of a
  522. // conditional formatting rule.
  523. type xlsxCfRule struct {
  524. Type string `xml:"type,attr,omitempty"`
  525. DxfID *int `xml:"dxfId,attr"`
  526. Priority int `xml:"priority,attr,omitempty"`
  527. StopIfTrue bool `xml:"stopIfTrue,attr,omitempty"`
  528. AboveAverage *bool `xml:"aboveAverage,attr"`
  529. Percent bool `xml:"percent,attr,omitempty"`
  530. Bottom bool `xml:"bottom,attr,omitempty"`
  531. Operator string `xml:"operator,attr,omitempty"`
  532. Text string `xml:"text,attr,omitempty"`
  533. TimePeriod string `xml:"timePeriod,attr,omitempty"`
  534. Rank int `xml:"rank,attr,omitempty"`
  535. StdDev int `xml:"stdDev,attr,omitempty"`
  536. EqualAverage bool `xml:"equalAverage,attr,omitempty"`
  537. Formula []string `xml:"formula,omitempty"`
  538. ColorScale *xlsxColorScale `xml:"colorScale"`
  539. DataBar *xlsxDataBar `xml:"dataBar"`
  540. IconSet *xlsxIconSet `xml:"iconSet"`
  541. ExtLst *xlsxExtLst `xml:"extLst"`
  542. }
  543. // xlsxColorScale (Color Scale) describes a gradated color scale in this
  544. // conditional formatting rule.
  545. type xlsxColorScale struct {
  546. Cfvo []*xlsxCfvo `xml:"cfvo"`
  547. Color []*xlsxColor `xml:"color"`
  548. }
  549. // dataBar (Data Bar) describes a data bar conditional formatting rule.
  550. type xlsxDataBar struct {
  551. MaxLength int `xml:"maxLength,attr,omitempty"`
  552. MinLength int `xml:"minLength,attr,omitempty"`
  553. ShowValue *bool `xml:"showValue,attr"`
  554. Cfvo []*xlsxCfvo `xml:"cfvo"`
  555. Color []*xlsxColor `xml:"color"`
  556. }
  557. // xlsxIconSet (Icon Set) describes an icon set conditional formatting rule.
  558. type xlsxIconSet struct {
  559. Cfvo []*xlsxCfvo `xml:"cfvo"`
  560. IconSet string `xml:"iconSet,attr,omitempty"`
  561. ShowValue *bool `xml:"showValue,attr"`
  562. Percent bool `xml:"percent,attr,omitempty"`
  563. Reverse bool `xml:"reverse,attr,omitempty"`
  564. }
  565. // cfvo (Conditional Format Value Object) describes the values of the
  566. // interpolation points in a gradient scale.
  567. type xlsxCfvo struct {
  568. Gte bool `xml:"gte,attr,omitempty"`
  569. Type string `xml:"type,attr,omitempty"`
  570. Val string `xml:"val,attr,omitempty"`
  571. ExtLst *xlsxExtLst `xml:"extLst"`
  572. }
  573. // xlsxHyperlinks directly maps the hyperlinks element in the namespace
  574. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - A hyperlink can
  575. // be stored in a package as a relationship. Hyperlinks shall be identified by
  576. // containing a target which specifies the destination of the given hyperlink.
  577. type xlsxHyperlinks struct {
  578. XMLName xml.Name `xml:"hyperlinks"`
  579. Hyperlink []xlsxHyperlink `xml:"hyperlink"`
  580. }
  581. // xlsxHyperlink directly maps the hyperlink element in the namespace
  582. // http://schemas.openxmlformats.org/spreadsheetml/2006/main
  583. type xlsxHyperlink struct {
  584. Ref string `xml:"ref,attr"`
  585. Location string `xml:"location,attr,omitempty"`
  586. Display string `xml:"display,attr,omitempty"`
  587. Tooltip string `xml:"tooltip,attr,omitempty"`
  588. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  589. }
  590. // xlsxTableParts directly maps the tableParts element in the namespace
  591. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - The table element
  592. // has several attributes applied to identify the table and the data range it
  593. // covers. The table id attribute needs to be unique across all table parts, the
  594. // same goes for the name and displayName. The displayName has the further
  595. // restriction that it must be unique across all defined names in the workbook.
  596. // Later on we will see that you can define names for many elements, such as
  597. // cells or formulas. The name value is used for the object model in Microsoft
  598. // Office Excel. The displayName is used for references in formulas. The ref
  599. // attribute is used to identify the cell range that the table covers. This
  600. // includes not only the table data, but also the table header containing column
  601. // names.
  602. // To add columns to your table you add new tableColumn elements to the
  603. // tableColumns container. Similar to the shared string table the collection
  604. // keeps a count attribute identifying the number of columns. Besides the table
  605. // definition in the table part there is also the need to identify which tables
  606. // are displayed in the worksheet. The worksheet part has a separate element
  607. // tableParts to store this information. Each table part is referenced through
  608. // the relationship ID and again a count of the number of table parts is
  609. // maintained. The following markup sample is taken from the documents
  610. // accompanying this book. The sheet data element has been removed to reduce the
  611. // size of the sample. To reference the table, just add the tableParts element,
  612. // of course after having created and stored the table part. For example:
  613. //
  614. // <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
  615. // ...
  616. // <tableParts count="1">
  617. // <tablePart r:id="rId1" />
  618. // </tableParts>
  619. // </worksheet>
  620. type xlsxTableParts struct {
  621. XMLName xml.Name `xml:"tableParts"`
  622. Count int `xml:"count,attr,omitempty"`
  623. TableParts []*xlsxTablePart `xml:"tablePart"`
  624. }
  625. // xlsxTablePart directly maps the tablePart element in the namespace
  626. // http://schemas.openxmlformats.org/spreadsheetml/2006/main
  627. type xlsxTablePart struct {
  628. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  629. }
  630. // xlsxPicture directly maps the picture element in the namespace
  631. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - Background sheet
  632. // image. For example:
  633. //
  634. // <picture r:id="rId1"/>
  635. type xlsxPicture struct {
  636. XMLName xml.Name `xml:"picture"`
  637. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  638. }
  639. // xlsxLegacyDrawing directly maps the legacyDrawing element in the namespace
  640. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - A comment is a
  641. // rich text note that is attached to, and associated with, a cell, separate
  642. // from other cell content. Comment content is stored separate from the cell,
  643. // and is displayed in a drawing object (like a text box) that is separate from,
  644. // but associated with, a cell. Comments are used as reminders, such as noting
  645. // how a complex formula works, or to provide feedback to other users. Comments
  646. // can also be used to explain assumptions made in a formula or to call out
  647. // something special about the cell.
  648. type xlsxLegacyDrawing struct {
  649. XMLName xml.Name `xml:"legacyDrawing"`
  650. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  651. }
  652. // xlsxLegacyDrawingHF specifies the explicit relationship to the part
  653. // containing the VML defining pictures rendered in the header / footer of the
  654. // sheet.
  655. type xlsxLegacyDrawingHF struct {
  656. XMLName xml.Name `xml:"legacyDrawingHF"`
  657. RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
  658. }
  659. // xlsxAlternateContent is a container for a sequence of multiple
  660. // representations of a given piece of content. The program reading the file
  661. // should only process one of these, and the one chosen should be based on
  662. // which conditions match.
  663. type xlsxAlternateContent struct {
  664. XMLNSMC string `xml:"xmlns:mc,attr,omitempty"`
  665. Content string `xml:",innerxml"`
  666. }
  667. // xlsxInnerXML holds parts of XML content currently not unmarshal.
  668. type xlsxInnerXML struct {
  669. Content string `xml:",innerxml"`
  670. }
  671. // xlsxWorksheetExt directly maps the ext element in the worksheet.
  672. type xlsxWorksheetExt struct {
  673. XMLName xml.Name `xml:"ext"`
  674. URI string `xml:"uri,attr"`
  675. Content string `xml:",innerxml"`
  676. }
  677. // decodeWorksheetExt directly maps the ext element.
  678. type decodeWorksheetExt struct {
  679. XMLName xml.Name `xml:"extLst"`
  680. Ext []*xlsxWorksheetExt `xml:"ext"`
  681. }
  682. // decodeX14SparklineGroups directly maps the sparklineGroups element.
  683. type decodeX14SparklineGroups struct {
  684. XMLName xml.Name `xml:"sparklineGroups"`
  685. XMLNSXM string `xml:"xmlns:xm,attr"`
  686. Content string `xml:",innerxml"`
  687. }
  688. // decodeX14ConditionalFormattingExt directly maps the ext
  689. // element.
  690. type decodeX14ConditionalFormattingExt struct {
  691. XMLName xml.Name `xml:"ext"`
  692. ID string `xml:"id"`
  693. }
  694. // decodeX14ConditionalFormattings directly maps the conditionalFormattings
  695. // element.
  696. type decodeX14ConditionalFormattings struct {
  697. XMLName xml.Name `xml:"conditionalFormattings"`
  698. XMLNSXM string `xml:"xmlns:xm,attr"`
  699. Content string `xml:",innerxml"`
  700. }
  701. // decodeX14ConditionalFormatting directly maps the conditionalFormatting
  702. // element.
  703. type decodeX14ConditionalFormatting struct {
  704. XMLName xml.Name `xml:"conditionalFormatting"`
  705. CfRule []*decodeX14CfRule `xml:"cfRule"`
  706. }
  707. // decodeX14CfRule directly maps the cfRule element.
  708. type decodeX14CfRule struct {
  709. XMLName xml.Name `xml:"cfRule"`
  710. Type string `xml:"type,attr,omitempty"`
  711. ID string `xml:"id,attr,omitempty"`
  712. DataBar *decodeX14DataBar `xml:"dataBar"`
  713. }
  714. // decodeX14DataBar directly maps the dataBar element.
  715. type decodeX14DataBar struct {
  716. XMLName xml.Name `xml:"dataBar"`
  717. MaxLength int `xml:"maxLength,attr"`
  718. MinLength int `xml:"minLength,attr"`
  719. Border bool `xml:"border,attr,omitempty"`
  720. Gradient bool `xml:"gradient,attr"`
  721. ShowValue bool `xml:"showValue,attr,omitempty"`
  722. Direction string `xml:"direction,attr,omitempty"`
  723. Cfvo []*xlsxCfvo `xml:"cfvo"`
  724. BorderColor *xlsxColor `xml:"borderColor"`
  725. NegativeFillColor *xlsxColor `xml:"negativeFillColor"`
  726. AxisColor *xlsxColor `xml:"axisColor"`
  727. }
  728. // xlsxX14ConditionalFormattings directly maps the conditionalFormattings
  729. // element.
  730. type xlsxX14ConditionalFormattings struct {
  731. XMLName xml.Name `xml:"x14:conditionalFormattings"`
  732. Content string `xml:",innerxml"`
  733. }
  734. // xlsxX14ConditionalFormatting directly maps the conditionalFormatting element.
  735. type xlsxX14ConditionalFormatting struct {
  736. XMLName xml.Name `xml:"x14:conditionalFormatting"`
  737. XMLNSXM string `xml:"xmlns:xm,attr"`
  738. CfRule []*xlsxX14CfRule `xml:"x14:cfRule"`
  739. }
  740. // xlsxX14CfRule directly maps the cfRule element.
  741. type xlsxX14CfRule struct {
  742. Type string `xml:"type,attr,omitempty"`
  743. ID string `xml:"id,attr,omitempty"`
  744. DataBar *xlsx14DataBar `xml:"x14:dataBar"`
  745. }
  746. // xlsx14DataBar directly maps the dataBar element.
  747. type xlsx14DataBar struct {
  748. MaxLength int `xml:"maxLength,attr"`
  749. MinLength int `xml:"minLength,attr"`
  750. Border bool `xml:"border,attr"`
  751. Gradient bool `xml:"gradient,attr"`
  752. ShowValue bool `xml:"showValue,attr,omitempty"`
  753. Direction string `xml:"direction,attr,omitempty"`
  754. Cfvo []*xlsxCfvo `xml:"x14:cfvo"`
  755. BorderColor *xlsxColor `xml:"x14:borderColor"`
  756. NegativeFillColor *xlsxColor `xml:"x14:negativeFillColor"`
  757. AxisColor *xlsxColor `xml:"x14:axisColor"`
  758. }
  759. // xlsxX14SparklineGroups directly maps the sparklineGroups element.
  760. type xlsxX14SparklineGroups struct {
  761. XMLName xml.Name `xml:"x14:sparklineGroups"`
  762. XMLNSXM string `xml:"xmlns:xm,attr"`
  763. SparklineGroups []*xlsxX14SparklineGroup `xml:"x14:sparklineGroup"`
  764. Content string `xml:",innerxml"`
  765. }
  766. // xlsxX14SparklineGroup directly maps the sparklineGroup element.
  767. type xlsxX14SparklineGroup struct {
  768. XMLName xml.Name `xml:"x14:sparklineGroup"`
  769. ManualMax int `xml:"manualMax,attr,omitempty"`
  770. ManualMin int `xml:"manualMin,attr,omitempty"`
  771. LineWeight float64 `xml:"lineWeight,attr,omitempty"`
  772. Type string `xml:"type,attr,omitempty"`
  773. DateAxis bool `xml:"dateAxis,attr,omitempty"`
  774. DisplayEmptyCellsAs string `xml:"displayEmptyCellsAs,attr,omitempty"`
  775. Markers bool `xml:"markers,attr,omitempty"`
  776. High bool `xml:"high,attr,omitempty"`
  777. Low bool `xml:"low,attr,omitempty"`
  778. First bool `xml:"first,attr,omitempty"`
  779. Last bool `xml:"last,attr,omitempty"`
  780. Negative bool `xml:"negative,attr,omitempty"`
  781. DisplayXAxis bool `xml:"displayXAxis,attr,omitempty"`
  782. DisplayHidden bool `xml:"displayHidden,attr,omitempty"`
  783. MinAxisType string `xml:"minAxisType,attr,omitempty"`
  784. MaxAxisType string `xml:"maxAxisType,attr,omitempty"`
  785. RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
  786. ColorSeries *xlsxTabColor `xml:"x14:colorSeries"`
  787. ColorNegative *xlsxTabColor `xml:"x14:colorNegative"`
  788. ColorAxis *xlsxColor `xml:"x14:colorAxis"`
  789. ColorMarkers *xlsxTabColor `xml:"x14:colorMarkers"`
  790. ColorFirst *xlsxTabColor `xml:"x14:colorFirst"`
  791. ColorLast *xlsxTabColor `xml:"x14:colorLast"`
  792. ColorHigh *xlsxTabColor `xml:"x14:colorHigh"`
  793. ColorLow *xlsxTabColor `xml:"x14:colorLow"`
  794. Sparklines xlsxX14Sparklines `xml:"x14:sparklines"`
  795. }
  796. // xlsxX14Sparklines directly maps the sparklines element.
  797. type xlsxX14Sparklines struct {
  798. Sparkline []*xlsxX14Sparkline `xml:"x14:sparkline"`
  799. }
  800. // xlsxX14Sparkline directly maps the sparkline element.
  801. type xlsxX14Sparkline struct {
  802. F string `xml:"xm:f"`
  803. Sqref string `xml:"xm:sqref"`
  804. }
  805. // SparklineOptions directly maps the settings of the sparkline.
  806. type SparklineOptions struct {
  807. Location []string
  808. Range []string
  809. Max int
  810. CustMax int
  811. Min int
  812. CustMin int
  813. Type string
  814. Weight float64
  815. DateAxis bool
  816. Markers bool
  817. High bool
  818. Low bool
  819. First bool
  820. Last bool
  821. Negative bool
  822. Axis bool
  823. Hidden bool
  824. Reverse bool
  825. Style int
  826. SeriesColor string
  827. NegativeColor string
  828. MarkersColor string
  829. FirstColor string
  830. LastColor string
  831. HightColor string
  832. LowColor string
  833. EmptyCells string
  834. }
  835. // PaneOptions directly maps the settings of the pane.
  836. type PaneOptions struct {
  837. SQRef string
  838. ActiveCell string
  839. Pane string
  840. }
  841. // Panes directly maps the settings of the panes.
  842. type Panes struct {
  843. Freeze bool
  844. Split bool
  845. XSplit int
  846. YSplit int
  847. TopLeftCell string
  848. ActivePane string
  849. Panes []PaneOptions
  850. }
  851. // ConditionalFormatOptions directly maps the conditional format settings of the cells.
  852. type ConditionalFormatOptions struct {
  853. Type string
  854. AboveAverage bool
  855. Percent bool
  856. Format int
  857. Criteria string
  858. Value string
  859. MinType string
  860. MidType string
  861. MaxType string
  862. MinValue string
  863. MidValue string
  864. MaxValue string
  865. MinColor string
  866. MidColor string
  867. MaxColor string
  868. BarColor string
  869. BarBorderColor string
  870. BarDirection string
  871. BarOnly bool
  872. BarSolid bool
  873. IconStyle string
  874. ReverseIcons bool
  875. IconsOnly bool
  876. StopIfTrue bool
  877. }
  878. // SheetProtectionOptions directly maps the settings of worksheet protection.
  879. type SheetProtectionOptions struct {
  880. AlgorithmName string
  881. AutoFilter bool
  882. DeleteColumns bool
  883. DeleteRows bool
  884. EditObjects bool
  885. EditScenarios bool
  886. FormatCells bool
  887. FormatColumns bool
  888. FormatRows bool
  889. InsertColumns bool
  890. InsertHyperlinks bool
  891. InsertRows bool
  892. Password string
  893. PivotTables bool
  894. SelectLockedCells bool
  895. SelectUnlockedCells bool
  896. Sort bool
  897. }
  898. // HeaderFooterOptions directly maps the settings of header and footer.
  899. type HeaderFooterOptions struct {
  900. AlignWithMargins bool
  901. DifferentFirst bool
  902. DifferentOddEven bool
  903. ScaleWithDoc bool
  904. OddHeader string
  905. OddFooter string
  906. EvenHeader string
  907. EvenFooter string
  908. FirstHeader string
  909. FirstFooter string
  910. }
  911. // PageLayoutMarginsOptions directly maps the settings of page layout margins.
  912. type PageLayoutMarginsOptions struct {
  913. Bottom *float64
  914. Footer *float64
  915. Header *float64
  916. Left *float64
  917. Right *float64
  918. Top *float64
  919. Horizontally *bool
  920. Vertically *bool
  921. }
  922. // PageLayoutOptions directly maps the settings of page layout.
  923. type PageLayoutOptions struct {
  924. // Size defines the paper size of the worksheet.
  925. Size *int
  926. // Orientation defines the orientation of page layout for a worksheet.
  927. Orientation *string
  928. // FirstPageNumber specified the first printed page number. If no value is
  929. // specified, then 'automatic' is assumed.
  930. FirstPageNumber *uint
  931. // AdjustTo defines the print scaling. This attribute is restricted to
  932. // value ranging from 10 (10%) to 400 (400%). This setting is overridden
  933. // when fitToWidth and/or fitToHeight are in use.
  934. AdjustTo *uint
  935. // FitToHeight specified the number of vertical pages to fit on.
  936. FitToHeight *int
  937. // FitToWidth specified the number of horizontal pages to fit on.
  938. FitToWidth *int
  939. // BlackAndWhite specified print black and white.
  940. BlackAndWhite *bool
  941. }
  942. // ViewOptions directly maps the settings of sheet view.
  943. type ViewOptions struct {
  944. // DefaultGridColor indicating that the consuming application should use
  945. // the default grid lines color(system dependent). Overrides any color
  946. // specified in colorId.
  947. DefaultGridColor *bool
  948. // RightToLeft indicating whether the sheet is in 'right to left' display
  949. // mode. When in this mode, Column A is on the far right, Column B; is one
  950. // column left of Column A, and so on. Also, information in cells is
  951. // displayed in the Right to Left format.
  952. RightToLeft *bool
  953. // ShowFormulas indicating whether this sheet should display formulas.
  954. ShowFormulas *bool
  955. // ShowGridLines indicating whether this sheet should display grid lines.
  956. ShowGridLines *bool
  957. // ShowRowColHeaders indicating whether the sheet should display row and
  958. // column headings.
  959. ShowRowColHeaders *bool
  960. // ShowRuler indicating this sheet should display ruler.
  961. ShowRuler *bool
  962. // ShowZeros indicating whether to "show a zero in cells that have zero
  963. // value". When using a formula to reference another cell which is empty,
  964. // the referenced value becomes 0 when the flag is true. (Default setting
  965. // is true.)
  966. ShowZeros *bool
  967. // TopLeftCell specifies a location of the top left visible cell Location
  968. // of the top left visible cell in the bottom right pane (when in
  969. // Left-to-Right mode).
  970. TopLeftCell *string
  971. // View indicating how sheet is displayed, by default it uses empty string
  972. // available options: normal, pageLayout, pageBreakPreview
  973. View *string
  974. // ZoomScale specifies a window zoom magnification for current view
  975. // representing percent values. This attribute is restricted to values
  976. // ranging from 10 to 400. Horizontal & Vertical scale together.
  977. ZoomScale *float64
  978. }
  979. // SheetPropsOptions directly maps the settings of sheet view.
  980. type SheetPropsOptions struct {
  981. // Specifies a stable name of the sheet, which should not change over time,
  982. // and does not change from user input. This name should be used by code
  983. // to reference a particular sheet.
  984. CodeName *string
  985. // EnableFormatConditionsCalculation indicating whether the conditional
  986. // formatting calculations shall be evaluated. If set to false, then the
  987. // min/max values of color scales or data bars or threshold values in Top N
  988. // rules shall not be updated. Essentially the conditional
  989. // formatting "calc" is off.
  990. EnableFormatConditionsCalculation *bool
  991. // Published indicating whether the worksheet is published.
  992. Published *bool
  993. // AutoPageBreaks indicating whether the sheet displays Automatic Page
  994. // Breaks.
  995. AutoPageBreaks *bool
  996. // FitToPage indicating whether the Fit to Page print option is enabled.
  997. FitToPage *bool
  998. // TabColorIndexed represents the indexed color value.
  999. TabColorIndexed *int
  1000. // TabColorRGB represents the standard Alpha Red Green Blue color value.
  1001. TabColorRGB *string
  1002. // TabColorTheme represents the zero-based index into the collection,
  1003. // referencing a particular value expressed in the Theme part.
  1004. TabColorTheme *int
  1005. // TabColorTint specifies the tint value applied to the color.
  1006. TabColorTint *float64
  1007. // OutlineSummaryBelow indicating whether summary rows appear below detail
  1008. // in an outline, when applying an outline.
  1009. OutlineSummaryBelow *bool
  1010. // OutlineSummaryRight indicating whether summary columns appear to the
  1011. // right of detail in an outline, when applying an outline.
  1012. OutlineSummaryRight *bool
  1013. // BaseColWidth specifies the number of characters of the maximum digit
  1014. // width of the normal style's font. This value does not include margin
  1015. // padding or extra padding for grid lines. It is only the number of
  1016. // characters.
  1017. BaseColWidth *uint8
  1018. // DefaultColWidth specifies the default column width measured as the
  1019. // number of characters of the maximum digit width of the normal style's
  1020. // font.
  1021. DefaultColWidth *float64
  1022. // DefaultRowHeight specifies the default row height measured in point
  1023. // size. Optimization so we don't have to write the height on all rows.
  1024. // This can be written out if most rows have custom height, to achieve the
  1025. // optimization.
  1026. DefaultRowHeight *float64
  1027. // CustomHeight specifies the custom height.
  1028. CustomHeight *bool
  1029. // ZeroHeight specifies if rows are hidden.
  1030. ZeroHeight *bool
  1031. // ThickTop specifies if rows have a thick top border by default.
  1032. ThickTop *bool
  1033. // ThickBottom specifies if rows have a thick bottom border by default.
  1034. ThickBottom *bool
  1035. }