xmlSharedStrings.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. Package excelize providing a set of functions that allow you to write to
  3. and read from XLSX files. Support reads and writes XLSX file generated by
  4. Microsoft Excel™ 2007 and later. Support save file without losing original
  5. charts of XLSX. This library needs Go version 1.8 or later.
  6. Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
  7. this source code is governed by a BSD-style license that can be found in
  8. the LICENSE file.
  9. */
  10. package excelize
  11. import "encoding/xml"
  12. // xlsxSST directly maps the sst element from the namespace
  13. // http://schemas.openxmlformats.org/spreadsheetml/2006/main. String values may
  14. // be stored directly inside spreadsheet cell elements; however, storing the
  15. // same value inside multiple cell elements can result in very large worksheet
  16. // Parts, possibly resulting in performance degradation. The Shared String Table
  17. // is an indexed list of string values, shared across the workbook, which allows
  18. // implementations to store values only once.
  19. type xlsxSST struct {
  20. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main sst"`
  21. Count int `xml:"count,attr"`
  22. UniqueCount int `xml:"uniqueCount,attr"`
  23. SI []xlsxSI `xml:"si"`
  24. }
  25. // xlsxSI directly maps the si element from the namespace
  26. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
  27. // not checked this for completeness - it does as much as I need.
  28. type xlsxSI struct {
  29. T string `xml:"t"`
  30. R []xlsxR `xml:"r"`
  31. }
  32. // xlsxR directly maps the r element from the namespace
  33. // http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
  34. // not checked this for completeness - it does as much as I need.
  35. type xlsxR struct {
  36. RPr *xlsxRPr `xml:"rPr"`
  37. T string `xml:"t"`
  38. }
  39. // xlsxRPr (Run Properties) specifies a set of run properties which shall be
  40. // applied to the contents of the parent run after all style formatting has been
  41. // applied to the text. These properties are defined as direct formatting, since
  42. // they are directly applied to the run and supersede any formatting from
  43. // styles.
  44. type xlsxRPr struct {
  45. B string `xml:"b,omitempty"`
  46. Sz *attrValFloat `xml:"sz"`
  47. Color *xlsxColor `xml:"color"`
  48. RFont *attrValString `xml:"rFont"`
  49. Family *attrValInt `xml:"family"`
  50. }