Good afternoon,
I'm creating an Excel file and need to span multiple columns. How can I do this?
Example: I want the Excel sheet to look like this
1 | 2 | 3 | 4 A | two columns wide | Hi
Thanks, Joe
Good afternoon,
I'm creating an Excel file and need to span multiple columns. How can I do this?
Example: I want the Excel sheet to look like this
1 | 2 | 3 | 4 A | two columns wide | Hi
Thanks, Joe
I think you may have sent this to the wrong list, this is for Ruby on Rails issues.
(If I remember correctly you mark the cells and right click and there is an option for spanning there).
Colin
I think you may have sent this to the wrong list, this is for Ruby on Rails issues.
(If I remember correctly you mark the cells and right click and there is an option for spanning there).
Colin
Sorry, I meant to add that I'm doing this programmatically with the Spreadsheet gem. I'm trying to get it to generate a spreadsheet with some cells spanning multiple columns.
Thanks for the reply, though, and sorry for not being clear ![]()
If you are running on Windows when creating your Excel file, the following code will do what you're looking for.
require 'win32ole'
excel = WIN32OLE.connect('Excel.Application') rescue excel = WIN32OLE.new('Excel.Application')
book = excel.workbooks.add sheet = book.worksheets(1)
sheet.Cells(1, 1).value = "text to go into merged cells" sheet.Range("A1:C1").Merge excel.visible = true
Unfortunately, I don't have any experience with the spreadsheet gem. When generating excel spreadsheets, I use the win32ole gem.
Hope this helps... Bob