Method: IsoDoc::WordFunction::Body#make_tr_attr

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

#make_tr_attr(td, row, totalrows) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/isodoc/word_function/body.rb', line 68

def make_tr_attr(td, row, totalrows)
  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"],
    align: td["align"], style: style.gsub(/\n/, "") }
end