RE: How to change CSV properties


#1

CSV is a text based format and doesn’t have the ability to set the font
style.

I’ve never tried this by you could set the response header to
application/vnd.ms-excel and output the text as a html table (setting
the filename to have a .htm extension).

Excel may manage to import the file and parse it correctly but I’d
consider it a longshot and if you get it working in one version of Excel
it may not work in others.

With a mime type of application/vnd.ms-excel Windows would normally
expect a .xl? file extension so you’d definitely be pushing the
boundries. Internet Explorer may also look at the .htm extension on the
filename and just render the table itself. In short it’s a hack that
probably wont work, now and in the future, but you never know your luck.

send_data(myreportDataAsHTMLTable,
:type => ‘application/vnd.ms-excel; charset=iso-8859-1;
header=present;’,
:filename => ‘invoicehistoryreportAsHTMLTable.htm’, :disposition =>
‘attachment’)

Ross