"Embedded OLE Object" Image Appears instead of Prism File Preview

@andrey.potapov
Then what is the alternative for this, because our requirement is that we will have to download the presentation to move it at different locations, in that case how can we expect the objects to work correctly?

@andrey.potapov

Additionally, we are encountering an issue with the Aspose.Cloud SDK, which imposes a limit of 100 API calls per day. Is there a way to increase the number of API calls we can make each day?

@VoyagerIT,

Instead of the object preview, you can use a file icon. The following code example shows you how to do this:

String documentName = "MyPresentation.pptx"; // in storage
int slideIndex = 1;
String oleFilePath = "MyWorkbook.xlsx";  // a local file
String oleProgId = "Excel.Sheet.12";
String iconFilePath = "MyExcelIcon.ico"; // a local file
String iconTitle = "My document";

byte[] iconData = Files.readAllBytes(Paths.get(iconFilePath));

OleObjectFrame oleFrame = new OleObjectFrame();
oleFrame.setX(20d);
oleFrame.setY(20d);
oleFrame.setWidth(70d);
oleFrame.setHeight(60d);
oleFrame.setLinkPath(oleFilePath);
oleFrame.setObjectProgId(oleProgId);

// Set the icon
oleFrame.setIsObjectIcon(true);
oleFrame.setSubstitutePictureFormat(new PictureFill());
oleFrame.getSubstitutePictureFormat().setBase64Data(Base64.getEncoder().encodeToString(iconData));
oleFrame.getSubstitutePictureFormat().setPictureFillMode(PictureFill.PictureFillModeEnum.STRETCH);
oleFrame.setSubstitutePictureTitle(iconTitle);

slidesApi.createShape(documentName, slideIndex, oleFrame, null, null, null, null, null, null);

Aspose Cloud provides free 150 API calls per month. If you need more, you have to obtain a license. You can contact our sales team on Aspose.Purchase forum.

@andrey.potapov
But I don’t want to show the objects as icon, I want it to be visible as an editable picture/preview.

@VoyagerIT,
The problem is related to the PowerPoint behavior. Unfortunately, I cannot offer you another way.

Hi @andrey.potapov,

Query 1 : When I am trying to embed an any object in ppt, first I am able to see “Embedded OLE Object” icon on download, but when I double click on that Icon, I am able to open the object (Tried objects- excel, jpeg, prism)

Query 2: Once I open that object in PPT, excel object is working fine but, other objects like prism and jpeg are then visible as icon.

Please find the PPTs, screenshots attached and find the used code below:

asposeConfig.slidesApi().createShape(filePath, slideIndex, oleFrame, null, null, null,null, null, null);

 public OleObjectFrame createOleObjectDetails(String progId, String linkPath, double x, double y, double width, double height, String base64FileData) {
        OleObjectFrame oleFrame = new OleObjectFrame();
        oleFrame.setX(x);
        oleFrame.setY(y);
        oleFrame.setWidth(width);
        oleFrame.setHeight(height);
        oleFrame.setObjectProgId(progId);
        oleFrame.setEmbeddedFileBase64Data(base64FileData);
        oleFrame.setEmbeddedFileExtension("xlsx");
        
        return oleFrame;
    }

Screenshots.zip (161.7 KB)

Sample Objects.zip (101.5 KB)

PPT with JPEG Object.zip (5.5 MB)

PPT with Excel Object.zip (5.5 MB)

PPT with Prism Object.zip (5.4 MB)

@VoyagerIT,
I am working on your queries and will get back to you soon.

With further investigation, we found out that this is working fine with Microsoft products like excel and word files.
Please look into this and provide a solution.
@andrey.potapov

@VoyagerIT,
Thank you for your patience. Unfortunately, PowerPoint may not use every software to make a preview of a file inside a presentation. For example, if you embed a JPEG file as an OLE object in a presentation manually (without an icon) you will see the same result as you described above.

@andrey.potapov Could you suggest any alternative through which we can achieve the expected?

@andrey.potapov
In case of prism, if I am adding the object manually, I am able to see the object and I am able to use it in PPT. I followed the below steps:

  1. Opened an empty presentation
  2. “Copy Graph” from prism file
  3. Pasted it in the PPT slide.
  4. Pasted prism graph is working as an object in PPT.

Please find the screen recording for the steps I followed. I want to implement the same functionality using aspose cloud API, let me know how we can do implement this.
Recording 2024-08-26 142426.zip (4.0 MB)

@VoyagerIT,
Thank you for the details.

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): SLIDESCLOUD-1981

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.

Hi @andrey.potapov , We tried with below 2 scenarios-

  1. Linked a file to PPT
  2. Embedded file data in PPT

In scenario 2, when we are opening the generated PPT for first time we are able to see “Embedded OLE Object” as an icon, when I double click the object, it is working fine in case of excel, but in case of prism, it is giving package.bin.pzfx icon

In both scenarios, if we add external image as an icon, that behaves static, when we change anything in the object, the icon image preview stays the same.

As per our use case, we should see the preview of prism objects also similar to excel object.
I request you to please help in investigating the issue. And let me know if I am not using the code as per Aspose’s requirement.
Refer to me code below-

public void addObjectToSlide(String filePath, int slideIndex, OleObjectFrame oleFrame) {
        log.info("Adding object to slide. File path: {}, Slide index: {}", filePath, slideIndex);
        try {
            asposeConfig.slidesApi().createShape(filePath, slideIndex, oleFrame, null, null, null, null, null, null);
            log.info("Object added to slide successfully. File path: {}, Slide index: {}", filePath, slideIndex);
        } catch (ApiException e) {
            log.error("Aspose Add Object API failed: ", e);
            throw new VHRASException(e);
        }
    }

    public OleObjectFrame createOleObjectDetails(String progId, String linkPath, double x, double y, double width, double height, String base64FileData) {
        // Create the OleObjectFrame object
        OleObjectFrame oleFrame = new OleObjectFrame();
        oleFrame.setX(x);
        oleFrame.setY(y);
        oleFrame.setWidth(width);
        oleFrame.setHeight(height);
        oleFrame.setObjectProgId(progId);
        oleFrame.setEmbeddedFileBase64Data(base64FileData);
        oleFrame.setSubstitutePictureFormat(new PictureFill());
        oleFrame.getSubstitutePictureFormat().setBase64Data("/ABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQB//2Q==");
        oleFrame.getSubstitutePictureFormat().setPictureFillMode(PictureFill.PictureFillModeEnum.STRETCH);
        oleFrame.setSubstitutePictureTitle("My Object");
//        oleFrame.setLinkPath("./"+linkPath);
        oleFrame.setIsObjectIcon(true);

        // Set the file extension based on progId
        switch (progId) {
            case "Prism10.Document":
                oleFrame.setEmbeddedFileExtension("pzfx");
                break;
            case "Excel.Sheet.12":
                oleFrame.setEmbeddedFileExtension("xlsx");
                break;
//            case "JPEG.Image":
//                oleFrame.setEmbeddedFileExtension("jpeg");
//                break;
//            case "PNG.Image":
//                oleFrame.setEmbeddedFileExtension("png");
//                break;
            case "JMPObject":
                oleFrame.setEmbeddedFileExtension("jmp");
                break;
            case "SpotfireObject":
                oleFrame.setEmbeddedFileExtension("dxp");
                break;
//            case "Word.Document.12":
//                oleFrame.setEmbeddedFileExtension("docx");
//                break;
            default:
                throw new IllegalArgumentException("Unsupported ProgID: " + progId);
        }

        return oleFrame;
    }

@VoyagerIT,
This happened because you set the “pzfx” extension for Prism files. Because Prism files have the “prism” extension, you should specify it as follows:

oleFrame.setEmbeddedFileExtension("prism");

I first tried with “prism” only, but this is not working
@andrey.potapov
image.png (14.9 KB)

Error attached when opening object in ppt with “prism” extension

@VoyagerIT,
I am working on the issue and will get back to you soon.

Appreciate your help - Thank you…Pls do consider the sample PPT attached in the below thread - This will give you a fair idea of expectation.

@VoyagerIT,
I’ve reproduced the problem you described above.

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): SLIDESCLOUD-1983

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.

Hi @andrey.potapov Thank you for the update, and I really appreciate you looking into this and identifying the root cause.

Just to clarify, the fix would be resolving the below items :

  1. by default preview of the objects in the ppt slide while embedding instead the placeholder “Ole Embedded Object”
  2. support extension files as attached : .xlsx, .prism, .jmp, .dxp

This issue is a blocker for deploying our complete application to production environment by next week and require an urgent hotfix.

Please could you confirm the fix you suggested resolves above mentioned 1 and 2, and if we go ahead with the developer paid support - can this be deployed by early next week?

Thanks
Sample extension files.zip (3.1 MB)

@VoyagerIT,
I don’t think issue 1 will be resolved because PowerPoint uses third-party applications to prepare previews when manually inserting files into presentations and Aspose.Slides does not interact with any applications. You should use images or icons instead.

I’ve forwarded this information and sample files to our developers.

Unfortunately, I can’t promise you any timeframe. Our developers need to study the Prism files case first. But if you raise the priority of the problem, it will be solved out of turn.