xmlSharedStrings.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2016 - 2019 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.8 or later.
  9. package excelize
  10. import "encoding/xml"
  11. // xlsxSST directly maps the sst element from the namespace
  12. // http://schemas.openxmlformats.org/spreadsheetml/2006/main. String values may
  13. // be stored directly inside spreadsheet cell elements; however, storing the
  14. // same value inside multiple cell elements can result in very large worksheet
  15. // Parts, possibly resulting in performance degradation. The Shared String Table
  16. // is an indexed list of string values, shared across the workbook, which allows
  17. // implementations to store values only once.
  18. type xlsxSST struct {
  19. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main sst"`
  20. Count int `xml:"count,attr"`
  21. UniqueCount int `xml:"uniqueCount,attr"`
  22. SI []xlsxSI `xml:"si"`
  23. }
  24. // xlsxSI directly maps the si element from the namespace
  25. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
  26. // not checked this for completeness - it does as much as I need.
  27. type xlsxSI struct {
  28. T string `xml:"t"`
  29. R []xlsxR `xml:"r"`
  30. }
  31. // xlsxR directly maps the r element from the namespace
  32. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
  33. // not checked this for completeness - it does as much as I need.
  34. type xlsxR struct {
  35. RPr *xlsxRPr `xml:"rPr"`
  36. T string `xml:"t"`
  37. }
  38. // xlsxRPr (Run Properties) specifies a set of run properties which shall be
  39. // applied to the contents of the parent run after all style formatting has been
  40. // applied to the text. These properties are defined as direct formatting, since
  41. // they are directly applied to the run and supersede any formatting from
  42. // styles.
  43. type xlsxRPr struct {
  44. B string `xml:"b,omitempty"`
  45. Sz *attrValFloat `xml:"sz"`
  46. Color *xlsxColor `xml:"color"`
  47. RFont *attrValString `xml:"rFont"`
  48. Family *attrValInt `xml:"family"`
  49. }