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


when using example app ryan bates' railscasts episode #362 exporting excel (https://github.com/railscasts/362-exporting-csv-and-excel), i've noticed excel 2010 (which on windows) gives me warning message when opening .xls file i've downloaded using "download excel" link.

the warning reads:

"the file trying open ... in different format specified file extension. verify file not corrupted , trusted source before opening file. want open file now?"

i can open file fine when click 'yes.' , don't warning message when using excel 2011 (on mac). i'd able provide excel file won't prompt warning when user downloads such file site.

note: i've tried replacing references in app .xls .xlsx, excel can't open file @ all. complains: "excel cannot open file. file format or file extension not valid. verify file has not been corrupted , file extension matches format of file."

i aware of gems such axlsx (https://github.com/randym/axlsx), hoping use railscasts method , make quick fix eliminate warning message excel 2010.

thank help!

the xls file generated railscasts application xml file in old excel 2003 xml format.

recent versions of excel have feature called extension hardening generate warning when file format doesn't match file extension:

the alert new security feature in excel 2007 called extension hardening, ensures file content being opened matches extension type specified in shell command attempting open file. because mime types listed above associated .xls extension, file must in xls (biff8) file format open without warning prompt.

in order avoid warning have generate excel file in format matches file extension. editing registry suggested workaround in above link isn't workable in practice. changing extension xml might work.

as alternatives writeexcel xls, write_xlsx xlsx , axlsx (that mention above) options.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -