style.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // xslx is a package designed to help with reading data from
  2. // spreadsheets stored in the XLSX format used in recent versions of
  3. // Microsoft's Excel spreadsheet.
  4. //
  5. // For a concise example of how to use this library why not check out
  6. // the source for xlsx2csv here: https://github.com/tealeg/xlsx2csv
  7. package xlsx
  8. // xlsxStyle directly maps the style element in the namespace
  9. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  10. // currently I have not checked it for completeness - it does as much
  11. // as I need.
  12. type xlsxStyles struct {
  13. Fonts []xlsxFont `xml:"fonts>font"`
  14. Fills []xlsxFill `xml:"fills>fill"`
  15. Borders []xlsxBorder `xml:"borders>border"`
  16. CellStyleXfs []xlsxXf `xml:"cellStyleXfs>xf"`
  17. CellXfs []xlsxXf `xml:"cellXfs>xf"`
  18. }
  19. // xlsxFont directly maps the font element in the namespace
  20. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  21. // currently I have not checked it for completeness - it does as much
  22. // as I need.
  23. type xlsxFont struct {
  24. Sz xlsxVal `xml:"sz"`
  25. Name xlsxVal `xml:"name"`
  26. Family xlsxVal `xml:"family"`
  27. Charset xlsxVal `xml:"charset"`
  28. }
  29. // xlsxVal directly maps the val element in the namespace
  30. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  31. // currently I have not checked it for completeness - it does as much
  32. // as I need.
  33. type xlsxVal struct {
  34. Val string `xml:"val,attr"`
  35. }
  36. // xlsxFill directly maps the fill element in the namespace
  37. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  38. // currently I have not checked it for completeness - it does as much
  39. // as I need.
  40. // ColorIndex ARGBValue
  41. // 0 00000000
  42. // 1 00FFFFFF
  43. // 2 00FF0000
  44. // 3 0000FF00
  45. // ...............
  46. // ...............
  47. type xlsxFill struct {
  48. FgColorIndex string
  49. BgColorIndex string
  50. }
  51. // xlsxBorder directly maps the border element in the namespace
  52. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  53. // currently I have not checked it for completeness - it does as much
  54. // as I need.
  55. type xlsxBorder struct {
  56. Left xlsxLine `xml:"left"`
  57. Right xlsxLine `xml:"right"`
  58. Top xlsxLine `xml:"top"`
  59. Bottom xlsxLine `xml:"bottom"`
  60. }
  61. // xlsxLine directly maps the line style element in the namespace
  62. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  63. // currently I have not checked it for completeness - it does as much
  64. // as I need.
  65. type xlsxLine struct {
  66. Style string `xml:"style,attr"`
  67. }
  68. // xlsxXf directly maps the xf element in the namespace
  69. // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
  70. // currently I have not checked it for completeness - it does as much
  71. // as I need.
  72. type xlsxXf struct {
  73. ApplyBorder string `xml:"applyBorder,attr"`
  74. BorderId int `xml:"borderId,attr"`
  75. ApplyFill string `xml:"applyFill,attr"`
  76. FillId int `xml:"fillId,attr"`
  77. }