How to preserve line breaks when exporting addresses from Ruby to Excel XML?
<p>I am trying to generate an <code>.xls</code> file with my Ruby on Rails application.</p>

<p>Everything works great, except for the addresses which are displayed all in one line. I would like them to have line breaks to be more readable. (In the MySQL database they are saved with line break characters as well.)</p>

<p>I have tried all sorts of things, including this one...</p>

<pre><code># index.xsl.erb

&lt;Cell&gt;&lt;Data ss:Type="String"&gt;&lt;%= invoice.address.gsub!("\n", '&amp;#13;') %&gt;&lt;/Data&gt;&lt;/Cell&gt;
</code></pre>

<p>... but to no avail. Excel simply converts my line break characters to <code>&amp;amp;#13</code> making it look even more ugly.</p>

<p>Any ideas how to get around this?</p>