col.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. style *Style
  13. }
  14. func (c *Col) SetType(cellType CellType) {
  15. switch cellType {
  16. case CellTypeString:
  17. c.numFmt = builtInNumFmt[builtInNumFmtIndex_STRING]
  18. case CellTypeBool:
  19. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL] //TEMP
  20. case CellTypeNumeric:
  21. c.numFmt = builtInNumFmt[builtInNumFmtIndex_INT]
  22. case CellTypeDate:
  23. c.numFmt = builtInNumFmt[builtInNumFmtIndex_DATE]
  24. case CellTypeFormula:
  25. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL]
  26. case CellTypeError:
  27. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL] //TEMP
  28. case CellTypeGeneral:
  29. c.numFmt = builtInNumFmt[builtInNumFmtIndex_GENERAL]
  30. }
  31. }
  32. // GetStyle returns the Style associated with a Col
  33. func (c *Col) GetStyle() *Style {
  34. return c.style
  35. }
  36. // SetStyle sets the style of a Col
  37. func (c *Col) SetStyle(style *Style) {
  38. c.style = style
  39. }