I'm looking for a library which will read all types of excel formats(eg:.xsl,.xlsx,.ods) I tried the The following code to read the spreadsheets.
try
{
string extension = Path.GetExtension(File1.PostedFile.FileName);
switch (extension.ToLower())
{
case ".xls":
excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
break;
case ".xlsx":
excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
break;
case ".ods":
excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
break;
}
}
catch (Exception ex)
{
}
It works fine for .xsl and .xlsx files but not working for openoffice .ods files. Can anyone confirm whether this supports openoffice or someother alternate which will fit to my requirement.