Hi Kirk, The file gets written to the right location though it ends up only being about 8 bytes in length. I would guess from this that it doesn't write it correctly.
Thanks, Matt Delves On Mar 9, 2009, at 9:53 PM, Torm3nt wrote: > Hi Matt, > > Could you be a little more specific? What do you mean by "write the > file correctly"? > > 1. Doesn't write it at all? > 2. Writes the file but screws up the formatting? > 3. Writes it to the wrong location? > > .etc.etc. > > > Kirk > > On Mon, Mar 9, 2009 at 9:04 PM, Matthew Delves <[email protected] > > wrote: > > Greetings all, > I've been looking at the spreadsheet (http:// > spreadsheet.rubyforge.org/) gem to get data exported from my database > to an excel document, though am running into a couple of hitches with > it. > > It doesn't want to write the file correctly. The code that I currently > have is: > > -- > def excel > # Create a new spreadsheet > book = Spreadsheet::Workbook.new > sheet = book.create_worksheet > sheet.name = 'All Member Details' > > # Add the header row > sheet.row(0).push Member.column_names > puts Member.column_names > > # Add the content > Member.find(:all).each_with_index do |member, index| > sheet.row(index + 1).push member.attributes.values > puts member.attributes.values > end > > # close the workbook > # book.close > > # Offer up the file for download > downloadpath = 'downloads/members.xls' > book.write downloadpath > send_file downloadpath, :x_sendfile => true > > end > -- > > Any help in getting this going would be greatly appreciated. > > Thanks, > Matt Delves > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
