|121309||Nov 30,2015 08:39 AM UTC||Dec 8,2015 05:16 AM UTC||ASP.NET Web Forms||2|
This error occurs when there is mismatch between the file format and its extension. This can be resolved by setting workbook version set to the required version.
· To save a workbook in Excel2003 format, set the workbook version to Excel97to2003 and save the file with extension ‘.xls’ i.e. binary file format.
· To save a workbook in Excel 2007/Excel2010/Excel2013 formats, set the workbook version to Excel2007/Excel2010/Excel2013 respectively and save the file with extension ‘.xlsx’ i.e. open xml file format.
The below code example illustrates the same.
string fileName = Server.MapPath("App_data/Sample.xls");
IWorkbook workbook = application.Workbooks.Open(fileName, ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets;
workbook.Version = ExcelVersion.Excel2007;
workbook.SaveAs(this.TextBox1.Text + ".xlsx", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel2007);
We have provided a sample as per your scenario in the below link for your reference. Kindly try with this and let us know.
Please let us know if you need any clarification.
From: suresh thota [mailto:firstname.lastname@example.org]
Sent: 12/02/2015 01:22 AM
To: Syncfusion Support <email@example.com>
Subject: Re: Syncfusion support community forum 121309, Excel can not able to open the file..., has been updated.
Thank you for your reply.
Yes. I have seen from one the the SyncFusion URL. Its working now.
Thank you very much for your support.
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.