can't open xls file

Can't open xls file and throw cannot recognize current file type. But I can open in ms excel.

ExcelEngine excelEngine = new ExcelEngine();

IApplication application = excelEngine.Excel;

application.DefaultVersion = ExcelVersion.Excel2013;

MemoryStream ms = new MemoryStream();

using (FileStream f = new FileStream(openFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))

{

f.CopyTo(ms);

}

ms.Seek(0, SeekOrigin.Begin);

IWorkbook wb = application.Workbooks.Open(ms);


Attachment: SIL197A,2412159_262042e.xls

1 Reply 1 reply marked as answer

AR Aravazhi Rajendran Syncfusion Team May 14, 2025 07:49 AM UTC

Hi Angus,

The "unsupported file exception" you're encountering when opening an .xls file is usually due to the file format being outdated.

We have a Knowledge Base article that explains why this happens and how you can resolve it:
Why XlsIO throws "cannot recognize current file type" exception?

Please follow the steps outlined in the article, and let us know if you run into any further issues or have any questions.

Regards,
Aravazhi Rajendran


Marked as answer
Loader.
Up arrow icon