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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 October 2010 21:11, Joe Peck <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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 | HiI 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> > 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). > > ColinSorry, 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 :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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
On Oct 25, 8:34 am, Joe Peck
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> > 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 :)
>
> --
> Posted viahttp://www.ruby-forum.com/.
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.