xmlCore.go 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. // DocProperties directly maps the document core properties.
  14. type DocProperties struct {
  15. Category string
  16. ContentStatus string
  17. Created string
  18. Creator string
  19. Description string
  20. Identifier string
  21. Keywords string
  22. LastModifiedBy string
  23. Modified string
  24. Revision string
  25. Subject string
  26. Title string
  27. Language string
  28. Version string
  29. }
  30. // decodeCoreProperties directly maps the root element for a part of this
  31. // content type shall coreProperties. In order to solve the problem that the
  32. // label structure is changed after serialization and deserialization, two
  33. // different structures are defined. decodeCoreProperties just for
  34. // deserialization.
  35. type decodeCoreProperties struct {
  36. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties coreProperties"`
  37. Title string `xml:"http://purl.org/dc/elements/1.1/ title,omitempty"`
  38. Subject string `xml:"http://purl.org/dc/elements/1.1/ subject,omitempty"`
  39. Creator string `xml:"http://purl.org/dc/elements/1.1/ creator"`
  40. Keywords string `xml:"keywords,omitempty"`
  41. Description string `xml:"http://purl.org/dc/elements/1.1/ description,omitempty"`
  42. LastModifiedBy string `xml:"lastModifiedBy"`
  43. Language string `xml:"http://purl.org/dc/elements/1.1/ language,omitempty"`
  44. Identifier string `xml:"http://purl.org/dc/elements/1.1/ identifier,omitempty"`
  45. Revision string `xml:"revision,omitempty"`
  46. Created struct {
  47. Text string `xml:",chardata"`
  48. Type string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
  49. } `xml:"http://purl.org/dc/terms/ created"`
  50. Modified struct {
  51. Text string `xml:",chardata"`
  52. Type string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
  53. } `xml:"http://purl.org/dc/terms/ modified"`
  54. ContentStatus string `xml:"contentStatus,omitempty"`
  55. Category string `xml:"category,omitempty"`
  56. Version string `xml:"version,omitempty"`
  57. }
  58. // xlsxCoreProperties directly maps the root element for a part of this
  59. // content type shall coreProperties.
  60. type xlsxCoreProperties struct {
  61. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties coreProperties"`
  62. Dc string `xml:"xmlns:dc,attr"`
  63. Dcterms string `xml:"xmlns:dcterms,attr"`
  64. Dcmitype string `xml:"xmlns:dcmitype,attr"`
  65. XSI string `xml:"xmlns:xsi,attr"`
  66. Title string `xml:"dc:title,omitempty"`
  67. Subject string `xml:"dc:subject,omitempty"`
  68. Creator string `xml:"dc:creator"`
  69. Keywords string `xml:"keywords,omitempty"`
  70. Description string `xml:"dc:description,omitempty"`
  71. LastModifiedBy string `xml:"lastModifiedBy"`
  72. Language string `xml:"dc:language,omitempty"`
  73. Identifier string `xml:"dc:identifier,omitempty"`
  74. Revision string `xml:"revision,omitempty"`
  75. Created struct {
  76. Text string `xml:",chardata"`
  77. Type string `xml:"xsi:type,attr"`
  78. } `xml:"dcterms:created"`
  79. Modified struct {
  80. Text string `xml:",chardata"`
  81. Type string `xml:"xsi:type,attr"`
  82. } `xml:"dcterms:modified"`
  83. ContentStatus string `xml:"contentStatus,omitempty"`
  84. Category string `xml:"category,omitempty"`
  85. Version string `xml:"version,omitempty"`
  86. }