col.go 1017 B

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