Is there any way to individually set the widths? or set a style for a
<td> tag so I can apply a style sheet to it?
The HTML formatter is very basic, simply concatenating the tag strings
with the values. The original way to adjust output is to override the
build_* method, such as build_row. Since I don't like mixing formatting
and code I tend to use ERB or HAML for output.
Hope that helps,
Andrew
class HTML < Ruport::Formatter::HTML
renders :html, :for => CarReport
def build_table_header
output << "\t\t<tr>\n\t\t\t"
@i = 0
data.column_names.each do |col|
output << "<th class='ruport_th#{@i}'></th>"
@i += 1
end
output << "\n\t\t</tr>\n"
end
def build_car_report
output << textile("h1. Car Report")
output << data.to_html(:style => :justified)
end
end
Still it doesn't pick up my build_table_header method.
I'm afraid I'm really busy at the moment to be of much help. You seem to
be doing the right thing so I'm not sure why it isn't working. The
renderer is perhaps a bit dumb when picking up Formatters and selects
the first in its list (formats method IIRC).
For the moment you could just render the table manually in the formatter.
I'll try to have a proper look tonight. None of my reports in any of my
projects use the HTML table formatter!
Best regards,
Andrew