• Stars
    star
    133
  • Rank 272,600 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 15 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

SpreadsheetOnRails

A gem to generate xls documents by using rxls templates.

Based on {Defv}[http://github.com/DefV]‘s railsxls plugin without the Java part.

Installation

In Rails 3, add this to your Gemfile and run the bundle command.

gem "spreadsheet_on_rails"

Getting Started

Add support for the new format in your controller:

class HomeController < ApplicationController

  def index
    respond_to do |format|
      format.html
      format.xls { render :xls => "<filename>"}
    end
  end
end

Create an xls view app/views/home/index.rxls:

sheet = workbook.create_worksheet
sheet.name = "What's in a name"

sheet.row(0).concat %w{Name Country Acknowlegement}
sheet[1,0] = 'Japan'
row = sheet.row(1)
row.push 'Creator of Ruby'
row.unshift 'Yukihiro Matsumoto'
sheet.row(2).replace [ 'Daniel J. Berger', 'U.S.A.',
                        'Author of original code for Spreadsheet::Excel' ]
sheet.row(3).push 'Charles Lowe', 'Author of the ruby-ole Library'
sheet.row(3).insert 1, 'Unknown'
sheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'

The view basically allow you to write directly with the spreadsheet gem.

<img src=“https://secure.travis-ci.org/10to1/spreadsheet_on_rails.png?branch=master” alt=“Build Status” />

Copyright © 2012 10to1, released under the MIT license