row.go 933 B

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