Spreadsheet gem

Hi,

Here is a newbie question on the spreadsheet gem.

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

require "spreadsheet"

@csd = cns_period_conv(params[:date][:year],params[:period_start])
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet #default sheet name Worksheet1
sheet1.name = 'My First Worksheet'
sheet2 = book.create_worksheet :name => 'My Second Worksheet'
sheet1.row(0).concat %w{Name Country Acknowlegement}
sheet1[1,0] = 'Japan' #get the Cell at row 1, column 0
sheet1.row(0).height = 40
format_1 = Spreadsheet::Format.new :rotation=> 90, :vertical_align 

=> :center, :horizontal_align=>:center
sheet1.row(0).set_format(0, format_1);
sheet1.row(2).push ‘One’,‘Two’,‘Three’

sheet1.column(2).width = "Acknoledgements".length
format_2 = Spreadsheet::Format.new :horizontal_align=> :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
harddisk. What have I missed?

Best regards,

Johan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs