1
Vote

The supplied POIFSFileSystem does not contain a BIFF8 'Workbook' entry. Is it really an excel file?

description

I am using NPOI to process data in Excel 2003 (xls) file. This is my code

if (excelFormat.Equals(Constants.XLS_EXCEL_FORMAT))
{
using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
  wbImportXLS = new HSSFWorkbook(file); //crash here
}
sheetImport = wbImportXLS.GetSheet(CommonController.GetFirstSheetNameInFileXLS(wbImportXLS));
isXLS = true;
}

However I receive an error

"The supplied POIFSFileSystem does not contain a BIFF8 'Workbook' entry. Is it really an excel file?"

I checked my excel file. That is not contain any password. I used Apache Tika and received this information

"Application-Name: Microsoft Excel
Author:
Category:
Comments:
Company:
Content-Length: 13312
Content-Type: application/vnd.ms-excel
Creation-Date: 2016-10-03T11:22:28Z
Keywords:
Last-Author:
Manager:
X-Parsed-By: org.apache.tika.parser.DefaultParser
X-Parsed-By: org.apache.tika.parser.microsoft.OfficeParser
X-TIKA:digest:MD5: f5a1e42d6d1674aadd0e03e8583cfbb3
X-TIKA:digest:SHA256: bffb673b20f3929d62e20514696d39406d524716f002dbec25284b64995ae9e0
comment:
cp:category:
cp:subject:
creator:
dc:creator:
dc:subject:
dc:title:
dcterms:created: 2016-10-03T11:22:28Z
extended-properties:Application: Microsoft Excel
extended-properties:Company:
extended-properties:Manager:
meta:author:
meta:creation-date: 2016-10-03T11:22:28Z
meta:keyword:
meta:last-author:
resourceName: TIKA.xls
subject:
title:
w:comments: "

However, if I open excel file and re-save, then my code work fine.

file attachments

comments