Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Spreadsheet gem

Thread Tools

Spreadsheet gem
Posts: n/a

Here is a newbie question on the spreadsheet gem.

I have the following simple test code in a controller action :

require "spreadsheet"

@csd =3D cns_period_conv(params[:date][:year],params[eriod_start])
book =3D
sheet1 =3D book.create_worksheet #default sheet name Worksheet1 =3D 'My First Worksheet'
sheet2 =3D book.create_worksheet :name =3D> 'My Second Worksheet'
sheet1.row(0).concat %w{Name Country Acknowlegement}
sheet1[1,0] =3D 'Japan' #get the Cell at row 1, column 0
sheet1.row(0).height =3D 40
format_1 =3D :rotation=3D> 90, :vertical_align =
=3D> :center, :horizontal_align=3D>:center
sheet1.row(0).set_format(0, format_1);
sheet1.row(2).push 'One','Two','Three'

sheet1.column(2).width =3D "Acknoledgements".length
format_2 =3D :horizontal_align=3D> :center
sheet1.row(0).set_format(2, format_2);

book.write 'Excel.xls'

I would like to open this file in Excel instead of saving it to the harddis=
k. What have I missed?

Best regards,


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spreadsheet gem errors Dominic Sisneros Ruby 0 10-21-2010 10:25 PM
Spreadsheet gem -- way to work with a subset of rows? Jim .. Ruby 0 12-19-2009 05:06 PM
Spreadsheet Manipulation Gem Alan Claughan Ruby 0 06-16-2009 04:17 PM
Printing problems with 'spreadsheet' gem Jim Burgess Ruby 2 01-16-2009 06:53 PM
RubyGems 0.9.1 calling a gem with gem '<gem>' Austin 7873 Ruby 5 01-27-2007 10:05 PM