Problem:
"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.
I faced this issue in QA
environment for one of the SharePoint project where in there was a sql report
rdlc file which was rendered in a report viewer control. When I try to Export
to Excel the report it throws above error and when I click on Yes option to
open the file it opens blank.
I could export the
report to PDF and work that works absolutely fine but only the problem was with
Export to Excel.
When I login with ADMIN
account everything works fine, with admin account I could export the report to
excel without any error.
Solution:
There could be multiple reasons for the problem
explained here, so not sure this solution will work for you but it worked great
in my case.
- Check the app pool account of the site where you are generating the report (say the app pool user account is: farmAppPoolUser
- Now browse the location:
- C:\Users\
farmAppPoolUser \AppData\Local\Temp
- Add "Authenticated Users" to Temp directory with "Full Control" permissions.
References: