HI , I am trying to download zip file which is having Excel1.xlsx file . When I extract zip file tried to open excel its giving error "Excel cannot open the file Excel1.xlsx because the file format or extension is not valid" . before downloading Zip file I am creating writing data to excel compressing .
same thing If I am creating file with extension ".xls" its opening without any error message .
Error Message- “file format or extension is not valid”:
If the file format is different than the extension then the MS Excel show the error “file format or extension is not valid”. Can you let me know whether you are generating the xlsx file using XlsIO with the Version property? Find the code snippet and online documentation link to change the workbook version using XlsIO.
Code Snippet to change the Workbook Version:
//Select the version to be saved
workbook.Version = ExcelVersion.Excel2007; //or
//workbook.Version = ExcelVersion.Excel2010;
//Save it as "Excel2007" format.
Online Documentation to change the Workbook Version:
If still the issue is reproducing then share us the code snippet which reproduces the issue.
There are various ways to fix this error mentioned in the below article. Please visit the URL:
I hope it will fix the issue.
Thanks for sharing this, we will take a look at it