Getting "com.aspose.cells.CellsException: Error for ZipFile" I am using aspose-cells-19.8.jar

Hi,

I am getting the following exception when trying to load an Excel file. I am able to open the same file in MS Excel without any problem. I am using the Aspose cells for Java version 19.8.

com.aspose.cells.CellsException: Error for ZipFile
at com.aspose.cells.zbaq.a(Unknown Source)
at com.aspose.cells.a.f.zj.(Unknown Source)
at com.aspose.cells.a.f.zj.a(Unknown Source)
at com.aspose.cells.zrz.a(Unknown Source)
at com.aspose.cells.zjp.a(Unknown Source)
at com.aspose.cells.zjp.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)

If i open the file in any excel tool (MS Excel) and save it as new or modify and save the same file, then the new file/modified file is working fine when parse using aspose-cells.

I am not able to share the excel file as it contains sensitive data. Please advice.

Seems this was occurred for other users earlier - com.aspose.cells.CellsException: Error for ZipFile

@sankar1217,

Thanks for the stacktrace.

Please try our our latest version/fix: Aspose.Cells for Java v23.6.

If your issue still occurs with Aspose.Cells for Java v23.6, then please provide us your source Excel file which is causing this exception. We will look into it and try to figure it out soon.

PS. please zip the file prior attaching.

@amjad.sahi Thanks, It is working fine in latest version.

@sankar1217,

Good to know that latest version fixes out your issue. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

1 Like

Hi @amjad.sahi we are using Aspose cells for Java version 23.6 to create xlsx file. Everything is fine but the size of the file is different for every file we generated using the same data.

Following is the sample code I am using.


import com.aspose.cells.Cells;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class GenerateExcelFile
{

public static void main(String[] args) throws Exception
{
	License license = new License(); 
	license.setLicense("license/Aspose.Total.Java.lic");
        Workbook ExcelWorkbook = new Workbook();
        Worksheet ExcelWorksheet = ExcelWorkbook.getWorksheets().get(0);
    	Cells WorksheetCells = ExcelWorksheet.getCells();
        WorksheetCells.get("A1").putValue("Customers Report");
    	WorksheetCells.get("A2").putValue("C_ID");
        WorksheetCells.get("B2").putValue("C_Name");
    	WorksheetCells.get("A3").putValue("C001");
        WorksheetCells.get("B3").putValue("Customer1");
    	WorksheetCells.get("A4").putValue("C002");
    	WorksheetCells.get("B4").putValue("Customer2");
        WorksheetCells.get("A5").putValue("C003");
        WorksheetCells.get("B5").putValue("Customer3");
    	WorksheetCells.get("A6").putValue("C004");
        WorksheetCells.get("B6").putValue("Customer4");
        ExcelWorkbook.save("ExcelFile.xlsx");
}

}


When ever I run this code I am getting the xlsx file with different size.

image.png (5.4 KB)

Previously we use Aspose Cells 19.8 and the same code will generate xlsx file with same size in 19.8 version.

Looks like this problem is occurring from Aspose Cells 20.3

Please share why the file size is different for each time we generate xlsx using the above code.

Thanks,
Sankara Narayanan N

@sankar1217,
An Excel file may contain one or multiple sheet pages. Each sheet page has a unique ID, and due to differences in unique IDs, there may be extremely subtle differences after compression. Please refer to the attachment (228.1 KB).

@John.He Is that this unique ID for each sheet is something which introduced in 20.3 version ? Because in 19.8 version we don’t find any size difference.

@sankar1217
Through testing with sample code, we can reproduce the issue. It was found that when executing the same code multiple times, the generated file may have different sizes.
This may be due to the compression algorithm. Anyway, we will create a ticket for research and notify you immediately once there are updates.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSJAVA-45594

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@sankar1217
We supported unique ID for each sheet in 2020. The size of file will be different for different sheet’s ID.
If you do not need the unique ID of the sheet and want to keep the file same size, please remove it as the following codes:

 ExcelWorksheet.setUniqueId(null);