Embed password protected zip file in excel

Hi Support
We are embedding a password protected zip file in excel via aspose.cells java api.
issue: if we extract this file and unzip with password then it does not unzip.
more details here:


Method1: if we use this code then it gives error:

byte[] data = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file);

fis.close();Workbook wb = new Workbook();
Worksheet sheet = wb.getWorksheets().get(0);
int oleObjIndex = sheet.getOleObjects().add(14, 3, 200, 220, null);
OleObject oleObj = sheet.getOleObjects().get(oleObjIndex);


error: Caused by: java.util.zip.ZipException: encrypted ZIP entry not supported.....com.aspose.cells.CellsException: Error for ZipFile

Method2: if we use this code “oleObj.setFileFormatType(FileFormatType.UNKNOWN);” then it is working but in that case file is not getting unzipped properly because code is changing the file format



For zip files, the file format type should be set to “Unknown”. Could your perform the task in MS Excel manually to get your expected output, save the file and provide us with all the steps involved. We will check on how to do it via Aspose.Cells APIs.

manual steps attached hereStep1.zip (925.1 KB)


I have checked and performed your steps as per your MS Word document. I used the following sample code with a sample .zip file (attached) to be embedded as an Ole object via Aspose.Cells APIs, it works fine and the output file (attached) is fine tuned. When I click on the ole object, I can open the zipped file and when I try to open file inside the zipped archive, it demands the password. I provided the password and it works fine to view the file too:
Sample code:

 // Get the image file.
        String path = "f:\\files\\aff24421-8c6a-4e1a-9dc4-ff369a7b6c3a.zip";
        File file = new File(path);

// Get the file into the streams.
        byte[] img = new byte[(int) file.length()];
        FileInputStream fis = new FileInputStream(file);

// Instantiate a new Workbook.
        Workbook wb = new Workbook();

// Get the first worksheet.
        Worksheet sheet = wb.getWorksheets().get(0);

// Add an Ole object into the worksheet with the image shown in MS Excel.
        int oleObjIndex = sheet.getOleObjects().add(14, 3, 200, 220, img);
        OleObject oleObj = sheet.getOleObjects().get(oleObjIndex);

// Set embedded ole object data and other attributes.

// Save the excel file

aff24421-8c6a-4e1a-9dc4-ff369a7b6c3a.zip (217 Bytes)
outfile1.zip (9.2 KB)

I am not entirely certain about what issue you are finding regarding Aspose.Cells APIs. Kindly provide more details, complete sample code (runnable), input Excel file, zipped file, and output Excel file processed by Aspose.Cells APIs. How do you extract the embedded ole object from the output XLSX file, share code segment as well. Also give some screenshot to highlight the issue. This will help us really to evaluate your precisely to figure it out soon.

We appreciate your work in this regard.