col.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package xlsx
  2. // Default column width in excel
  3. const ColWidth = 9.5
  4. type Col struct {
  5. Min int
  6. Max int
  7. Hidden bool
  8. Width float64
  9. Collapsed bool
  10. OutlineLevel uint8
  11. numFmt string
  12. parsedNumFmt *parsedNumberFormat
  13. style *Style
  14. }
  15. func (c *Col) SetType(cellType CellType) {
  16. switch cellType {
  17. case CellTypeString:
  18. c.numFmt = builtInNumFmt[builtInNumFmtIndex_STRING]
  19. case CellTypeBool:
  20. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL] //TEMP
  21. case CellTypeNumeric:
  22. c.numFmt = builtInNumFmt[builtInNumFmtIndex_INT]
  23. case CellTypeDate:
  24. c.numFmt = builtInNumFmt[builtInNumFmtIndex_DATE]
  25. case CellTypeFormula:
  26. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL]
  27. case CellTypeError:
  28. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL] //TEMP
  29. case CellTypeGeneral:
  30. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL]
  31. }
  32. }
  33. // GetStyle returns the Style associated with a Col
  34. func (c *Col) GetStyle() *Style {
  35. return c.style
  36. }
  37. // SetStyle sets the style of a Col
  38. func (c *Col) SetStyle(style *Style) {
  39. c.style = style
  40. }