为什么我不能生成大XLS(> 1000行)?

时间:2013-11-18 10:40:56

标签: ruby-on-rails excel xls

我搜索了更快的XLS生成,我找到了这个Railscast

我创建了10000个产品并在模型中添加了更多字段。

在XLS模板中,我输出了20多个字段。

已导出1000个产品,但当我尝试增加此数量(以测试性能)时,LibreOffice无法打开它。还尝试将其上传到GoogleDrive并打开 - 也失败了。

我的模板可能出错了吗?

<?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>
          ...20 headers...
       </Row>   
      <% @products.each do |product| %>
        <Row>
          <Cell><Data ss:Type="Number"><%= product.id %></Data></Cell>
          ...20 fields ...  
        </Row>
      <% end %>
    </Table>
  </Worksheet>
</Workbook>

0 个答案:

没有答案