Error for ZipFile java.util.zip.ZipException: invalid block type when open excel

Hi Team,

Could you please help to check this issue? I have an Excel 2010, when i try to open it, it throws error: Error for ZipFile java.util.zip.ZipException: invalid block type.

Why it throws ZipFile error?

My open code is as below:
public Workbook getWorkBook(String excelPath) throws Exception{
try {
LoadOptions opt = new LoadOptions();
opt.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);
Workbook wb = new Workbook(excelPath, opt);
return wb;
} catch(Exception ex) {
System.out.println(ex);
}
}

Aspose version: aspose-cells-8.2.0.4.jar

Hi Sissi,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells for Java (Latest Version) and see if it resolves your issue.

If your issue still occurs, then please provide us your source Excel file which is causing this exception. We will look into it and help you asap.

Hi,

Can you help me to understand why it throws zipfile exception when open excel file? This happened occasionally for same excel file, not every time. But I hope I can understand the root cause or possible reason.

here is my code:
Workbook wb = new Workbook(“excelpath”);

details exception is
com.aspose.cells.CellsException: Error for ZipFile
at com.aspose.cells.akw.a(Unknown Source)
at com.aspose.cells.a.f.i.(Unknown Source)
at com.aspose.cells.a.f.i.a(Unknown Source)
at com.aspose.cells.mh.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
Caused by: java.util.zip.ZipException: invalid block type
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:154)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at com.aspose.cells.a.f.f.d(Unknown Source)
at com.aspose.cells.a.f.f.(Unknown Source)
at com.aspose.cells.a.f.e.a(Unknown Source)
… 22 more

Thanks.

Hi Sissi,


Thank you for writing back.

I am afraid, it is hard to say what could have caused the said problem unless we replicate the scenario first on our end. Moreover, we have looked into our issue database to find occurrences of this error com.aspose.cells.CellsException: Error for ZipFile, and was unable to find any. Most probably the issue was never reported by any other users of Aspose.Cells APIs. We would request you to please share the problematic sample here so we could properly investigate the problem cause, and provide you with information in this regard.