Gregory said:
You mean ERb templates? Yeah, we support them, though I've never had
any feature requests or suggestions about them so I tend to forget
they're even there. Here is a simple example
No, I mean, that if I have a query and I need to display data in
different formats(html, pdf, csv), can I describe data's view in some
file such as test.xml:
<?xml version="1.0"?>
<!DOCTYPE report >
<Report fontSize="9" orientation="landscape">
<ReportHeader>
<Output>
<Line/>
<Line fontSize="16">
<literal>Something:</literal>
</Line>
<Line/>
<Line fontSize="12">
<literal>Report's name</literal>
</Line>
<Line fontsize="4"/>
<HorizontalLine size="4" bgcolor="'white'"/>
<HorizontalLine size="2" bgcolor="'black'"/>
<HorizontalLine size="4" bgcolor="'white'"/>
</Output>
</ReportHeader>
.....................
.....................
or in yaml format, and after this when I generate my report in all
formats, I will have data good looking.
Now, when I execute code somthing like this:
class MyRuport < Ruport::Report
include DogTag
attr_accessor :main_query
attr_accessor
![Stick Out Tongue :p :p](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
arameters
attr_accessor
![Eek! :eek: :eek:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
utput_format
prepare do
generate do
query(main_query, {:as => output_format.to_sym})
end
end
ruport = MyReport.new
ruport.main_query = "select * from test_table"
ruport.output_format = "html"
ruport.run{ |res| puts res.results }
I have results:
<table>
<tr>
<th>id</th>
<th>test</th>
</tr>
</table>
O something like this in pdf...
Can I put into my project some template file that will give outout data
looks better? And how can I do this with ruport. And have the ruport
some standart ways to solve this problem.
Thank you for answers. Artem Lakin.