row.go 943 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package xlsx
  2. import "strconv"
  3. type Row struct {
  4. Cells []*Cell
  5. Hidden bool
  6. Sheet *Sheet
  7. Height float64
  8. OutlineLevel uint8
  9. isCustom bool
  10. }
  11. func (r *Row) SetHeight(ht float64) {
  12. r.Height = ht
  13. r.isCustom = true
  14. }
  15. func (r *Row) SetHeightCM(ht float64) {
  16. r.Height = ht * 28.3464567 // Convert CM to postscript points
  17. r.isCustom = true
  18. }
  19. func (r *Row) AddCell() *Cell {
  20. cell := NewCell(r)
  21. r.Cells = append(r.Cells, cell)
  22. r.Sheet.maybeAddCol(len(r.Cells))
  23. return cell
  24. }
  25. // AddStreamCell takes as input a StreamCell, creates a new Cell from it,
  26. // and appends the new cell to the row.
  27. func (r *Row) AddStreamCell(streamCell StreamCell) {
  28. cell := NewCell(r)
  29. cell.Value = streamCell.cellData
  30. cell.style = streamCell.cellStyle.style
  31. cell.NumFmt = strconv.Itoa(streamCell.cellStyle.xNumFmtId)
  32. cell.cellType = streamCell.cellType
  33. r.Cells = append(r.Cells, cell)
  34. r.Sheet.maybeAddCol(len(r.Cells))
  35. }