i've a problem when i try to open a workbook with XSSFWorkbook method.
With a lot of xlsx file i've got no problem, but if we made some changes on a excel file with a Mac Pro and try to open it in my project i got this error stacktrace :
Wrong Local header signature: 0x4ACF92AD
à NPOI.OpenXml4Net.Util.ZipInputStreamZipEntrySource..ctor(ZipInputStream inp)
à NPOI.OpenXml4Net.OPC.ZipPackage..ctor(Stream filestream, PackageAccess access)
à NPOI.OpenXml4Net.OPC.OPCPackage.Open(Stream in1)
à NPOI.Util.PackageHelper.Open(Stream is1)
à NPOI.XSSF.UserModel.XSSFWorkbook..ctor(Stream is1)
You can found code i wrote below :
protected static IWorkbook GetWorkbook(FileInfo file)
IWorkbook workBook = null;
using (var stream = file.OpenRead())
stream.Position = 0; // <-------- rewind the stream
workBook = new XSSFWorkbook(stream);
else if (file.Name.ToUpper().EndsWith(".XLS"))
workBook = new HSSFWorkbook(stream);
I think i've a problem when we save it on Appel and try to read it on Microsoft system.
How can i do to solve it and allow my project to open Excel file by any possible mean ?
Thanks a lot