Closed rohitpbhore closed 7 years ago
That's not how ruby code is written in ERB. Try this instead:
<%
format_xls 'table.my-table' do
workbook use_autowidth: true
format 'th', b: true
format 'tr', bg_color: lambda { |row| 'ddffdd' if row.index.odd? }
end
%>
<table id="my-table">
<tr><td>One</td></tr>
<tr><td>Two</td></tr>
<tr><td>Three</td></tr>
<tr><td>Four</td></tr>
<tr><td>Five</td></tr>
</table>
apologize for the silly mistake.
That's not how ruby code is written in ERB. Try this instead: <% format_xls 'table.my-table' do workbook use_autowidth: true format 'th', b: true format 'tr', bg_color: lambda { |row| 'ddffdd' if row.index.odd? } end %>
One Two Three Four Five
I tried this exact same code - I get the spreadsheet without any colors anywhere! Please help!
I could able to successfully deliver .xlsx file using this gem. But facing issue while formatting. I have this below ERB template where I am trying to format, but it didn't work.
results.xlsx.erb
Thanks in advance @glebm