class RubyDocx::Elements::TableRow

Public Instance Methods

cells() click to toggle source
# File lib/ruby_docx/elements/table_row.rb, line 4
def cells
  self.elements
end
to_html() click to toggle source
# File lib/ruby_docx/elements/table_row.rb, line 20
def to_html
  w = 0
  if self.style
    w = self.style.width.to_i
  end

  s = "<tr>"
  self.cells.map do |cell|
    if w.to_i > 0
      s += "<td style='width: #{(w/100.0).round(2)}%'>#{cell.inner_html}</td>"
    else
      s += "<td>#{cell.inner_html}</td>"
    end
  end

  s += "</tr>"

  s
end
to_s() click to toggle source
# File lib/ruby_docx/elements/table_row.rb, line 8
def to_s
  s = ""

  self.cells.map do |cell|
    s += "#{cell.to_s}\t"
  end

  s += "\n"

  s
end