I try to create Excel files with the gem "axlsx". But i work for the first time with this gem and i try one Test.
I make one link_to to an controller action. There is no Error, but i didnt find a complete excel file.
Link_to :
<%= link_to "Test", { :controller => :orders, :action => :invoices_generate }, { class: "btn btn-primary btn-lg", style: "width: 100%;", format: 'xlsx'} %>
My Controller :
def invoices_generate
respond_to do |format|
format.xlsx
end
end
invoices_generate.xlsx.axlsx :
if examples.include? :basic
wb.add_worksheet(:name => "Basic Worksheet") do |sheet|
sheet.add_row ["First Column", "Second", "Third"]
sheet.add_row [1, 2, 3]
sheet.add_row [' preserving whitespace']
end
end