xmlCore.go 3.8 KB

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