<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Worksheet ss:Name="Sheet1">
<Table>
<Row>
<Cell><Data ss:Type="String">ID</Data></Cell>
<Cell><Data ss:Type="String">Name</Data></Cell>
<Cell><Data ss:Type="String">Email</Data></Cell>
<Cell><Data ss:Type="String">Registered On</Data></Cell>
</Row>
<% users.compact.each do |user| %>
<Row>
<Cell><Data ss:Type="Number"><%= user.id %></Data></Cell>
<Cell><Data ss:Type="String"><%= user.name %></Data></Cell>
<Cell><Data ss:Type="String"><%= user.email%></Data></Cell>
<Cell><Data ss:Type="Date"><%= user.created_at.to_s(:long)%></Data></Cell>
</Row>
<% end %>
</Table>
</Worksheet>
</Workbook>
Controller:
def index
respond_to do |format|
format.html
format.xls
end
end
index.html.haml file links to some_path(format: "xls")
The above code is located in index.xls.erb. When I go download the xls file, I open a spreadsheet that just has the code above pasted into it. Any clue what I'm doing wrong?