Opening Excel file gives "This file's format is not supported or you don't specify a correct format" in .NET

Hi,


I get the error “This file’s format is not supported or you don’t specify a correct format” when opening the attached excel file.

Can you tel me how I can open this type of file (I need to convert it to PDF) and how to detect that this file is different to other files, so that I can keep my code generic for all Excel files?

My code nor looks like:

Workbook workbook = new Workbook(inputFileName);

Aspose.Cells.PdfSaveOptions options = new Aspose.Cells.PdfSaveOptions();

options.Compliance = Aspose.Cells.Rendering.PdfCompliance.None;

string outputFileName = Path.Combine(outputPath, Path.ChangeExtension(Path.GetFileName(inputFileName), “.pdf”));

workbook.Save(outputFileName, options);
Regards
Andreas

Hi,


Thanks for providing us template file and sample code.

I have evaluated your issue using your template file. Well, I noticed your provided spreadsheet has an unsupported format. Please note, Aspose.Cells APIs supports BIFF8 or greater formats (Excel 97 - Excel 2010/2013, Excel 2016) however, the provided sample is of type “Microsoft Excel 5.0/95 Workbook”. Unfortunately, there isn’t a dynamic way to tackle this situation unless you manually change the format of the spreadsheet while using Excel (e.g 2003/2007-2013) application and load the re-saved spreadsheet with Aspose.Cells APIs.

Thank you.

@a.ruge,

BIFF7 or older formats are now supported in new versions, so you may try our latest version/fix to accomplish the task: