We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Excel warning

Hi
We are getting the warning message when we are trying to open the excel file opened via IE7 or 8. But don’t get the warning from firefox. Also if you select yes it opens without any issue. Following is the code I’m using. Please let me know how can I solve this issue.

Error
"The file you are trying to open, ‘[filename]’, 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. Do
you want to open the file now?"

Code

License license = new License();
license.SetLicense(“Aspose.Total.lic”); //the license file is an embedded resource in the project
//Open a template excel file
excelFileName = Server.MapPath("~/Templates/TrainerProgressReport.xls");
//For the first time open the workbook from the template
workbook = new Workbook(excelFileName);
//Get the worksheet cells
int count = 0;
foreach (Curriculum theCurriculum in theCurriculumCollection) {
string name = theCurriculum.Name;
if (name.Length > 30)
workbook.Worksheets[count].Name = name.Substring(0, 30);
else
workbook.Worksheets[count].Name = name;
Cells cells = workbook.Worksheets[count].Cells;
cells.ImportDataTable(getTrainerProgressReportTable(theCurriculum.CurriculumID), true, 0, 0, true);
count++;
}
workbook.Save(this.Response, “TrainerProgressReport”, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));
Response.End();


Hi,

Well, we think it is not Aspose.Cells’s issue rather it is some security check of MS Excel 2007 performed by the browser. It actually changes the settings in the Registry. See a topic on the issue: http://forums.asp.net/p/1070490/1560113.aspx


Also, check the msdn blog:
http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/03/11/excel-2007-extension-warning.aspx

Thank you.