Railscasts Episode #362 - Exporting to Excel: How to avoid the warning message given by Excel 2010 when opening the file?

前端 未结 2 1611
滥情空心
滥情空心 2021-01-18 12:12

When using the example app from Ryan Bates\' Railscasts Episode #362 about exporting to Excel (https://github.com/railscasts/362-exporting-csv-and-excel), I\'ve noticed that

2条回答
  •  一生所求
    2021-01-18 12:45

    In fact, the code generated:

    
    
      
        
            ID
            Name
            Release Date
            Price
          
        <% @products.each do |product| %>
          
            <%= product.id %>
            <%= product.name %>
            <%= product.released_on %>
            <%= product.price %>
          
        <% end %>
        

    is XML (XLS is a binary format, XLST a zipped format)

    Renaming the file to .xml should work

提交回复
热议问题