Method: IsoDoc::WordFunction::Body#make_tr_attr

Defined in:
lib/isodoc/word_function/table.rb

#make_tr_attr(td, row, totalrows, _header) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/isodoc/word_function/table.rb', line 23

def make_tr_attr(td, row, totalrows, _header)
  style = td.name == "th" ? "font-weight:bold;" : ""
  rowmax = td["rowspan"] ? row + td["rowspan"].to_i - 1 : row
  style += <<~STYLE
    border-top:#{row.zero? ? "#{SW1} 1.5pt;" : 'none;'}
    mso-border-top-alt:#{row.zero? ? "#{SW1} 1.5pt;" : 'none;'}
    border-bottom:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
    mso-border-bottom-alt:#{SW1} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
  STYLE
  { rowspan: td["rowspan"], colspan: td["colspan"], valign: td["valign"],
    align: td["align"], style: style.gsub(/\n/, "") }
end