# Ruport-util 0.7.0 : csv2ods and other fun stuff

**URL:** <https://www.ruby-forum.com/t/ruport-util-0-7-0-csv2ods-and-other-fun-stuff/106230>\
**Category:** Ruby\
**Created:** [June 7, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/ruport-util-0-7-0-csv2ods-and-other-fun-stuff/106230 "2007-06-07T18:28:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [June 7, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/ruport-util-0-7-0-csv2ods-and-other-fun-stuff/106230/1 "2007-06-07T18:28:58Z")

</div>

== What is it?

ruport-util provides a home for marooned former parts of Ruby Reports,  
and newer fringe ideas.

== Examples of new stuff

## csv2ods and Ruport::Formatter::ODS

ruport-util now comes with a tool called csv2ods which will convert a  
csv file to an OpenDocument spreadsheet file. You do not need  
[OpenOffice.org](http://OpenOffice.org) installed to use this tool.

– usage:

csv2ods my.csv my.ods

This is simply implemented as a Ruport table formatter, so you can use  
it programatically, too.

For example, if you’re reporting against an ActiveRecord model

class MyModel  
acts\_as\_reportable  
end

MyModel.report\_table(:all,:conditions =\> [“name = ?”, “Fat  
Louie”]).to\_ods

## Streamlined Report class

Our report runner has been simplified and many dumb features were cut  
out of it.

One cool new feature is implicit file type handling:

#------  
class MyReport \< Ruport::Report

renders\_as\_table

attr\_accessor :file

def renderable\_data  
t = Table(file)  
t.sub\_table { |r| r.a == “foo” }  
end

end

MyReport.generate do |report|  
report.file = “in.csv”  
report.save\_as “out.csv” # renders to csv  
report.save\_as “out.pdf” # renders to pdf  
puts report.to\_text # renders to screen as text  
end  
#-----

rope has been updated to generate the new Report definitions.

== Getting Ruport

To use ruport-util, you’ll need Ruport \>= 0.12.0

sudo gem install ruport -y

== Installing ruport-util

It’s on RubyForge:

gem install ruport-util -y

== Using

require “ruport”  
require “ruport/util”

# then just use whatever tools you want.

== Full Feature List as of 2007.06.07:

- Basic Graphing (util/graph)
- Report runner (util/report)
- Report Mailing (util/mailer)
- Report Manager (util/report\_manager)
- Invoices (util/invoice)
- PDF form helpers (util/pdf/form)
- ODS formatter for tables (util/ods)
- Benchmarking Tool (util/bench)
- Ruport centric code generation via the rope command.
- csv to OpenDocument conversion via csv2ods

See example/ for more information

== Help?

This code is unstable, evil, and possibly buggy until further notice.

Please report any problems on the Ruport mailing list:  
[http://list.rubyreports.org](http://list.rubyreports.org)

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [June 7, 2007, 6:30pm UTC](https://www.ruby-forum.com/t/ruport-util-0-7-0-csv2ods-and-other-fun-stuff/106230/2 "2007-06-07T18:30:58Z")

</div>

I forgot to mention: Many thanks to manveru for joining the Ruport  
core team and adding in all the ODS stuff!

(He also converted all our ruport-util tests to specs, so double  
thanks!)

---

<div class="post-metadata">

**Author:** ![naething](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47774/32.png) [@naething](https://www.ruby-forum.com/u/naething)\
**Post date:** [June 7, 2007, 10:12pm UTC](https://www.ruby-forum.com/t/ruport-util-0-7-0-csv2ods-and-other-fun-stuff/106230/3 "2007-06-07T22:12:34Z")

</div>

Turns out I forgot to add the dependency for rubyzip to the gemspec.  
Just added it and did an 0.7.1 release.

you can of course, do a manual gem install rubyzip if you’d like.

-greg
