I export an Excel document with DisplayTag. It saves as a .xls file to my Desktop. When I open it with Excel, this error displays:
"The file you are trying to open, 'filename.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file."
If I click "Yes", it displays just fine in Excel. If I open this with Textpad, I see that it's a binary file, but it appears to just be "." delimited strings.
Any ideas what I might have done wrong, or how next to debug this?
edit::
If I change the extension to .txt, it's not a binary file; it's simply a list of delimited strings.
Are you on Excel 2007? Seems to be a known issue:
This errors particularly occurs when you’re trying to open an XLS file (Excel 2000-2003) with Excel 2007. In most cases, the problem can be solved by defining MIME types and associating them with extensions.
...
However, if you don’t want to look for a solution, but just want to solve the problem, insert this key in your registry to suppress the notification:
[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security] “ExtensionHardening”=dword:00000000
You can accomplish the above by doing the following:
The default export class for Excel was set to the CSV class, but giving it the .xls extension. Changing displaytag.properties was the key here, something like:
You need to add the below lines in your properties file:
But this outputs the current page record only and not the complete list.