Subscribe to RSS Feed
Twitter
HIRE ME! home  archives  about  blogroll

Spreadsheet on Rails

06 Apr 2009

What?

A Rails plugin to generate xls documents by using rxls templates. Spreadsheet on Rails

Based on Defv’s railsxls plugin without the Java part. The without the java part was possible thanks to the excellent spreadsheet gem.

Of met andere woorden het antwoord op: “Kan ik daar ook een export naar Excel van krijgen?”

How?

In de view - “index.xls.rxls”

sheet = workbook.create_worksheet
sheet.name = "What's in a name"
sheet.row(0).concat %w{Name Country Acknowlegement}
sheet[1,0] = 'Japan'

In de controller

def index
  @lines = Line.find(:all)

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @lines }
    format.xls  { render :action => "index", :layout => false }
  end
end

Onder het motto, give something back, is it available on GitHub

update Removed the ”?” in the example sheetname. Thanks rebo!

blog comments powered by Disqus