excel - Rails 4, axlsx, and acts_as_xlsx: How to make each column its own sheet? -


gems

https://github.com/randym/axlsx

https://github.com/randym/acts_as_xlsx

tutorial

http://axlsx.blog.randym.net/2011/12/axlsx-making-excel-reports-with-ruby-on.html

in tutorial post model added excel sheet each attribute being column. however, purposes, each post own sheet. new both of these gems , having trouble making adjustment.

has accomplished share did?

with reference this example, can create workbook each column , copy first sheet of each workbook new workbook sheets model

format.xlsx {   p = axlsx::package.new   wb = p.workbook    col_1 = post.to_xlsx({:columns => [:id]})             :name => "posts1"    wb.worksheets[0] = col_1.workbook.worksheets.first    col_2 = post.to_xlsx({:columns => [:content]})             :name => "posts2"    wb.worksheets[1] = col_2.workbook.worksheets.first    begin     temp = tempfile.new("posts.xlsx")     p.serialize temp.path     send_file temp.path, :filename => "posts.xlsx", :type => "application/xlsx"   ensure     temp.close     temp.unlink   end }   

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -