Reputation: 3032
I am using axlxs
and axlsx_rails
. I can create inline spreadsheets no problem - for example I have an index.xlsx.axlsx
file etc.
The problem is I have another action the uses the exact same code so I tried creating a partial _export.xlsx.axlsx
and moving my code in there. I then replaced index.xlsx.axlsx
with render 'export'
.
I get an excel spreadsheet generated by Excel says it's corrupted. I can just duplicate my code in another file but there must be an easier way to do this.
Upvotes: 1
Views: 1070
Reputation: 2145
Try:
wb = xlsx_package.workbook
render partial: 'export', locals: {wb: wb}
If you have a different variable than wb
, pass that in, or pass in xlsx_package
, etc.
Upvotes: 5