0

I'm trying to read an Excel file with extension .xlsx which is created using Spreadsheetgear2017 and I'm getting an exception stating Corrupt open XML file.

Here I'm sure that the sheet doesnt contain any Cell comments and form controls as the sheet itself was created using Spreadsheetgear2017.

I tried to save the file in .xls format but when I open the downloaded file, there is a popup stating "The file format and extension of filename.xls file don't match. The file could be corrupted."

Here I'm using GetWorkBook(value) method.

where am I missing out ?

upendra
  • 1
  • 1
  • 1
    Impossible to say with just the information provided, as the problem involves something about your particular file's contents. But without the file itself to examine, there's no way to say what SpreadsheetGear is running into that's corrupt. – Tim Andersen Feb 07 '21 at 00:43
  • Sidenote on the XLS issue--it sounds like when saving the file you might still be specifying FileFormat.OpenXMLWorkbook (.xlsx) but just changing the filename to end in ".xls". That just results in an Open XML file with the wrong *.xls extension, which Excel complains about. If you want to save to the older Excel 97-2003 (.xls) file format, you should pass in the FileFormat.Excel8 enum option when saving, and give the filename an appropriate extension (.xls). – Tim Andersen Feb 07 '21 at 00:46
  • @TimAndersen Thank you soo much for taking time to help. passing FileFormat.Excel8 enum worked for me .. thanks alot :) – upendra Feb 07 '21 at 01:44

0 Answers0