We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Replace embedded object with a picture

Hello,

I’m trying to remove an embedded object from a workbook but still have it’s picture displayed.
I used the following code:

    Workbook book = new Workbook("C:\\Embedded.xlsx");
    for (Object sheet : book.getWorksheets()) {
        for (Object obj : ((Worksheet)sheet).getShapes()) {
            Shape shape = (Shape)obj;
            if (shape.getMsoDrawingType() == MsoDrawingType.OLE_OBJECT) {
                OleObject ole = (OleObject)shape;
                ole.setObjectData(null);
            }
        }
    }
    book.save("C:\\Embedded1.xls", SaveFormat.EXCEL_97_TO_2003);
    book.save("C:\\Embedded2.xlsx", SaveFormat.XLSX);

Seems like it works fine in Embedded2.xlsx while Embedded1.xls is broken.
Could you please advise?

embedded.zip (33.8 KB)

@Shiran1,

Thanks for the sample code segment and template file.

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found replacing embedded object with a picture does not work for XLS file format, it works fine for XLSX file format though. May be it is due to XLS file format structure limitation. Anyways, we have to look into it thoroughly and if it is a bug, we will sort it out. I have logged a ticket with an id “CELLSJAVA-43098” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@Shiran1,

Please try our latest version/fix: Aspose.Cells for Java v20.1.4 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose_Cells_Java_v20.1.4.zip (6.8 MB)

@Amjad_Sahi,
The fix is working for me.
Thanks!

@Shiran1

Good to know that your issue is sorted out by the new fix/version. 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.

The issues you have found earlier (filed as CELLSJAVA-43098) have been fixed in Aspose.Cells for Java v20.3. This message was posted using Bugs notification tool by ahsaniqbalsidiqui