Documatic: reports for Ruby

A new reporting and document production tool has been released for Ruby called "Documatic".

Documatic is an OpenDocument processor for Ruby. It can be used to produce attractive printable documents such as database reports, invoices, letters, faxes and more. Both the data inputs and the printable output are very flexible and easy to configure.

It can be used from within Ruby on Rails or from standalone Ruby scripts.

You prepare your report templates in OpenOffice.org, entering your Ruby code straight into the document itself. The bits of Ruby code are marked with special styles that tell the report compiler to treat those parts as code.

The data for your report can be anything: arrays, hashes, ActiveRecord objects etc. etc. When the template is processed you pass in all the values and they become available in the embedded Ruby binding.

Documatic is Free software (public domain), available as a Rubygem from http://rubyforge.org/projects/documatic. You can install it with the command "gem install documatic".

The Documatic homepage has more details on how to use Documatic, including a live Rails demonstration of a Documatic report, plus a standalone Ruby script demonstration you can download and experiment with.

http://documatic.240gl.org

If anyone has any comments or questions I'll be here in this group. Thanks for your time.

Regards, Dave Nelson

Interesting. I've been playing around with Energon which it sounds like is a similar tool. Have you seen it?

http://rubyforge.org/projects/energon

Good work!

Interesting. I've been playing around with Energon which it sounds like is a similar tool. Have you seen it?

Thanks for the reference, Greg. I hadn't actually heard of Energon before, but it seems quite similar, I'll give it a go.

Documatic is quite specific to OpenDocument: unlike Energon it won't work with Word or Excel documents. But this specificity gives it some features that (I think) are powerful: the ability to loop over table rows and list items, partials, and direct access to the XML DOM via REXML and XPath.

Regards, Dave

Yeah, I am actually happy because I have no way to meaningfully verify my patches against the Word / Excel Energon code :-/

dear sender, i�m out of the office until may 29th. your email will not be forwarded. for urgent stuff please contact joern@fork.de kind regards, alexander

Hi, Very interesting, my designers would be glad to design reports with OO. One issue is the lack of exporting formats (pdf, rtf, ...). I'm not an expert in OpenDocument, but perhaps is it easily be converted ? Thus I think Documatic would be a very interesting alternative

Hi Dave

I'm using documatic with great success, it's a really cool aproach to reporting. However, I have a problem with grouping and page breaks. I have a report which renders groups of data in a table. Each group should start on a new page. So I wrote the following inline code in my template:

data['gruppen'].each do |pruefungs_nr, nennungen_rows| ... <table stuff here> end

I inserted a manual page break before the end statement. This works very well, but documatic seems to have some built in magic which eliminates the page break if the following group fits on the same page. While I found this very cool, my customer doesn't like it. Is there any way to override this behaviour?

Thanks in advance and best regards Gernot