xmlTable.go 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package excelize
  2. import "encoding/xml"
  3. // xlsxTable directly maps the table element. A table helps organize and provide
  4. // structure to lists of information in a worksheet. Tables have clearly labeled
  5. // columns, rows, and data regions. Tables make it easier for users to sort,
  6. // analyze, format, manage, add, and delete information. This element is the
  7. // root element for a table that is not a single cell XML table.
  8. type xlsxTable struct {
  9. XMLName xml.Name `xml:"table"`
  10. XMLNS string `xml:"xmlns,attr"`
  11. DataCellStyle string `xml:"dataCellStyle,attr,omitempty"`
  12. DataDxfID int `xml:"dataDxfId,attr,omitempty"`
  13. DisplayName string `xml:"displayName,attr,omitempty"`
  14. HeaderRowBorderDxfID int `xml:"headerRowBorderDxfId,attr,omitempty"`
  15. HeaderRowCellStyle string `xml:"headerRowCellStyle,attr,omitempty"`
  16. HeaderRowCount int `xml:"headerRowCount,attr,omitempty"`
  17. HeaderRowDxfID int `xml:"headerRowDxfId,attr,omitempty"`
  18. ID int `xml:"id,attr"`
  19. InsertRow bool `xml:"insertRow,attr,omitempty"`
  20. InsertRowShift bool `xml:"insertRowShift,attr,omitempty"`
  21. Name string `xml:"name,attr"`
  22. Published bool `xml:"published,attr,omitempty"`
  23. Ref string `xml:"ref,attr"`
  24. TotalsRowCount int `xml:"totalsRowCount,attr,omitempty"`
  25. TotalsRowDxfID int `xml:"totalsRowDxfId,attr,omitempty"`
  26. TotalsRowShown bool `xml:"totalsRowShown,attr"`
  27. AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
  28. TableColumns *xlsxTableColumns `xml:"tableColumns"`
  29. TableStyleInfo *xlsxTableStyleInfo `xml:"tableStyleInfo"`
  30. }
  31. // xlsxAutoFilter temporarily hides rows based on a filter criteria, which is
  32. // applied column by column to a table of data in the worksheet. This collection
  33. // expresses AutoFilter settings.
  34. type xlsxAutoFilter struct {
  35. Ref string `xml:"ref,attr"`
  36. }
  37. // xlsxTableColumns directly maps the element representing the collection of all
  38. // table columns for this table.
  39. type xlsxTableColumns struct {
  40. Count int `xml:"count,attr"`
  41. TableColumn []*xlsxTableColumn `xml:"tableColumn"`
  42. }
  43. // xlsxTableColumn directly maps the element representing a single column for
  44. // this table.
  45. type xlsxTableColumn struct {
  46. DataCellStyle string `xml:"dataCellStyle,attr,omitempty"`
  47. DataDxfID int `xml:"dataDxfId,attr,omitempty"`
  48. HeaderRowCellStyle string `xml:"headerRowCellStyle,attr,omitempty"`
  49. HeaderRowDxfID int `xml:"headerRowDxfId,attr,omitempty"`
  50. ID int `xml:"id,attr"`
  51. Name string `xml:"name,attr"`
  52. QueryTableFieldID int `xml:"queryTableFieldId,attr,omitempty"`
  53. TotalsRowCellStyle string `xml:"totalsRowCellStyle,attr,omitempty"`
  54. TotalsRowDxfID int `xml:"totalsRowDxfId,attr,omitempty"`
  55. TotalsRowFunction string `xml:"totalsRowFunction,attr,omitempty"`
  56. TotalsRowLabel string `xml:"totalsRowLabel,attr,omitempty"`
  57. UniqueName string `xml:"uniqueName,attr,omitempty"`
  58. }
  59. // xlsxTableStyleInfo directly maps the tableStyleInfo element. This element
  60. // describes which style is used to display this table, and specifies which
  61. // portions of the table have the style applied.
  62. type xlsxTableStyleInfo struct {
  63. Name string `xml:"name,attr,omitempty"`
  64. ShowFirstColumn bool `xml:"showFirstColumn,attr"`
  65. ShowLastColumn bool `xml:"showLastColumn,attr"`
  66. ShowRowStripes bool `xml:"showRowStripes,attr"`
  67. ShowColumnStripes bool `xml:"showColumnStripes,attr"`
  68. }
  69. // formatTable directly maps the format settings of the table.
  70. type formatTable struct {
  71. TableStyle string `json:"table_style"`
  72. ShowFirstColumn bool `json:"show_first_column"`
  73. ShowLastColumn bool `json:"show_last_column"`
  74. ShowRowStripes bool `json:"show_row_stripes"`
  75. ShowColumnStripes bool `json:"show_column_stripes"`
  76. }