Aspose queries

@sukritisehgal,
As for Aspose.Slides,

  1. Aspose.Slides doesn’t have a built-in option like “use Office 2016 style,” but you can emulate it by:

    • Loading a PowerPoint 2016 template (.pptx or .potx) created with the desired styles.
    • Inserting content into this pre-styled presentation so all elements inherit the 2016 look.
    • Applying themes from Office 2016 by copying slides from a styled template.
    • Manually setting fonts, colors, and effects that match Office 2016 defaults.
  2. Aspose.Slides currently supports embedding charts from Excel only via OLE objects or by creating charts programmatically using the API. Unfortunately, inserting a chart as a linked object in a way that allows it to open in Excel via the “Edit Data” option—without using OLE—is not supported.
    Additionally, DDE (Dynamic Data Exchange) is a deprecated Microsoft technology and is not supported by Aspose.Slides.

  3. There are no differences in functionality between Aspose.Slides for Python via .NET and Aspose.Slides for Java. Both APIs offer the same features and capabilities, as they are built on the same core codebase. This ensures full parity across platforms, so you can expect identical behavior and results regardless of the language or runtime you use.

Hi
Thank you for answers 1) and 3)
For answer 2)
I have another use case.
I have a Powerpoint with different Microsoft objects - text, tables and charts.
I also have a seperate Excel file with the same objects on the first Excel sheet. I want to to link each object from the Powerpoint to the Excel.

I have manually created my desired output in MS Excel and Powerpoint, it will be great if you can help me do this programmatically via Aspose. Can you please share an email address so I can email it to you ?
Thanks

@sukritisehgal,
You can zip the files and attach the archive to a message in this forum thread.

Please also describe in more detail what you would like to do with them.

Hi
It is not recommended to share the files on a public forum, as they are used within our firm.
If you can share an email address, that will be great.

Given a Powerpoint and an Excel, I want to to link each object from the Powerpoint to the Excel, i.e.

  1. If I edit the Powerpoint text or table, that should be reflected in the Excel.
  2. If I edit the Excel text or table, it should be reflected on the Powerpoint.
  3. If I click on a Powerpoint chart, it should open the Excel (they should be linked). If I update data in the Excel, it should change the Powerpoint chart.

I am ok with any approach that accomplishes this - OLE, DDE or anything else.
Thanks

I am also getting an error when I try to upload - “Sorry there was an error uploading the file. Please try again
I tried about 10 times. Confirming I tried to upload zip files.

@sukritisehgal,
Thank you for describing the use cases.

Please follow the instructions below to send us the files privately. We will mark them as confidential.
How to Send License File to Support Team

Hi Andrey

Appreciate you sharing a method so I can send the files privately.
However, I am still getting the error : Sorry, there was an error uploading that file. Please try again.

My zip files are 64 KB and 35KB in size, not sure why they are not getting uploaded. Is there any other way I can send them ? Please feel free to email me directly at sukriti.sehgal@gs.com

@sukritisehgal,
Unfortunately, I can’t determine the cause of the error you encountered. We are sorry that you encountered this problem. Please send the files to andrey.potapov@aspose.com.

@sukritisehgal,
I received your email. I will prepare the information and get back to you soon.

@sukritisehgal,
We have opened the following new ticket(s) in our internal issue tracking system and will address the issues according to the terms outlined at Free Support Policies.

Issue ID(s): SLIDESJAVA-39662

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.

Thanks, please let me know if there is any solution on this.

@sukritisehgal,
We will keep you updated. Thank you for your patience.

@sukritisehgal,
Our developers have reviewed your requirements.

Please try using the following code example:

String excelFileName = "linked_excel.xlsx";
Presentation presentation = new Presentation();
ISlide slide = presentation.getSlides().get_Item(0);

Workbook workbook = new Workbook(excelFileName);
Range cellRange = workbook.getWorksheets().get("sheet1").getCells().createRange("G2:M12");

IOleObjectFrame frame = slide.getShapes().addOleObjectFrame(20, 300, 400, 200, "Excel.Sheet.12", excelFileName);
frame.setLinkPathLong(frame.getLinkPathLong() + getAddressOnWorksheet(cellRange));
frame.getSubstitutePictureFormat().getPicture().getImage().replaceImage(createOleImage(cellRange));
frame.setUpdateAutomatic(false);

cellRange = workbook.getWorksheets().get("sheet1").getCells().createRange("C2:E23");
frame = slide.getShapes().addOleObjectFrame(420, 20, 200, 100, "Excel.Sheet.12", excelFileName);
frame.setLinkPathLong(frame.getLinkPathLong() + getAddressOnWorksheet(cellRange));
frame.getSubstitutePictureFormat().getPicture().getImage().replaceImage(createOleImage(cellRange));
frame.setUpdateAutomatic(false);

cellRange = workbook.getWorksheets().get("sheet1").getCells().createRange("G18:J22");
frame = slide.getShapes().addOleObjectFrame(20, 20, 200, 70, "Excel.Sheet.12", excelFileName);
frame.setLinkPathLong(frame.getLinkPathLong() + getAddressOnWorksheet(cellRange));
frame.getSubstitutePictureFormat().getPicture().getImage().replaceImage(createOleImage(cellRange));
frame.setUpdateAutomatic(false);

cellRange = workbook.getWorksheets().get("sheet1").getCells().createRange("C26:E31");
frame = slide.getShapes().addOleObjectFrame(420, 300, 200, 70, "Excel.Sheet.12", excelFileName);
frame.setLinkPathLong(frame.getLinkPathLong() + getAddressOnWorksheet(cellRange));
frame.getSubstitutePictureFormat().getPicture().getImage().replaceImage(createOleImage(cellRange));
frame.setUpdateAutomatic(false);

presentation.save("output.pptx", SaveFormat.Pptx);
presentation.dispose();
static String getAddressOnWorksheet(Range cellRange)
{
    String worksheetName = "sheet1";
    return "!"+worksheetName+"!R"+(cellRange.getFirstRow() + 1)+ "C" + (cellRange.getFirstColumn() + 1) +
            ":R"+(cellRange.getFirstRow() + cellRange.getRowCount())+"C" + (cellRange.getColumnCount() + cellRange.getFirstColumn());
}

static byte[] createOleImage(com.aspose.cells.Range cellRange) throws Exception
{
    PageSetup pageSetup = cellRange.getWorksheet().getPageSetup();
    pageSetup.setPrintArea(cellRange.getAddress());
    pageSetup.setLeftMargin(0);
    pageSetup.setRightMargin(0);
    pageSetup.setTopMargin(0);
    pageSetup.setBottomMargin(0);
    pageSetup.clearHeaderFooter();

    ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
    ImageOrPrintOptions imageOrPrintOptions = new ImageOrPrintOptions();
    imageOrPrintOptions.setOnePagePerSheet(true);
    imageOrPrintOptions.setOnlyArea(true);
    imageOrPrintOptions.setImageType(com.aspose.cells.ImageType.EMF);

    SheetRender sheetRender = new SheetRender(cellRange.getWorksheet(),
            imageOrPrintOptions);
    sheetRender.toImage(0, imageStream);

    return imageStream.toByteArray();
}

However, we want to point out that the issue with the OLE shape size changing when updating links is still present. Unfortunately, there is nothing we can do on our end at this time, as this is an OLE object linking issue between PowerPoint and Excel.

Manage OLE|Aspose.Slides Documentation
Object Preview Issue when Adding OleObjectFrame|Aspose.Slides Documentation

Hi Andrey

Thanks for sharing the code.
I tried this approach but the tables and text on the presentation are images, not OLE objects.
We need on the data on the presentation to change when the excel changes.

I am able to do this with a single table using :

slide.shapes.add_ole_object_frame(
        50, 50, 500, 300,  # x, y, width, height
        "Excel.Sheet.12",  # ProgID for Excel
        excel_file_path    # Path to the linked Excel file
    )

But this approach only works when the table starts at cell A1 of the Excel file.

We will also prefer embedded(not linked) excels for all the tables and text with OLE objects on the presentation. Incase embedded is not an option, we can also work with a linked excel.

Thanks
Sukriti

@sukritisehgal,

When you manually add an OLE object to a PowerPoint presentation, an image of the object is automatically created and displayed on the slide (provided that the icon option is not selected for the object). Aspose.Slides offers the same capability.

The code example above demonstrates how to specify the cell range for the OLE object data.

This article shows how to add OLE objects with embedded Excel files.

Please let us know if you have any difficulties with this, and describe the issue in greater detail.

Hi Andrey,

I understand. This is exactly what I am looking to do programmatically. But the code you shared above, adds the tables as images not OLE objects.
To clarify, if I add an OLE object in PowerPoint, you are correct that it creates and displays an image of the object. But if I change the underlying Excel data, the image gets refreshed.
This refreshing capability is not working in the code you have shared above. The images on the presentation are static images.

Yes, I am following the same approach. This lets me create an embedded excel for the OLE objects. But it shows the entire excel sheet as an image instead of just 1 table, G2: M12. I tried using the createRange function similar to your code, but it is still displaying the entire excel sheet.

Can you please help to share another code example, that adds the OLE objects to the PPT with a refresh capability. Similar to pasting using Ctrl + Alt+ V manually → paste Link manually.
The requirement is that even though it is an image it should refresh when the underlying data changes.

Happy to get on a call to discuss this further.
This is very important for us.

@sukritisehgal,
We provide free support exclusively on this forum. We apologize for any inconvenience caused. I need some time to check the issue. I will get back to you as soon as possible.

Hi Andrey

I have been working with this as well, I realized if I right click on the image(after using the code you shared) and click on Update Link it actually refreshes the image.
So this is a viable solution for us, thank you.
I am good with the linking(instead of embedding) as long as I can link all objects using the OLE approach - charts, tables and text

Can you also please share some code embedding charts as OLE objects and linking(not embedding) them to an excel file. I have a chart in the ppt and excel file I shared with you on email, so you can use that as an example.
To clarify the problem statement, given a chart and data in Excel.
Add the chart as an OLE object in PowerPoint, such that PowerPoint shows the image of the chart, but double clicking the chart opens the Excel file. emulating the Ctrl + Alt + V behavior manually.

This is my code to accomplish this, but it renders the entire Excel as an image on the PPt instead of just the chart.

sheet_name = "Apple, Inc."
chart_index = 0  # Index of the chart in the worksheet
chart = workbook.worksheets.get(sheet_name).charts[chart_index]

img_stream = io.BytesIO()
chart.to_image(img_stream, ImageType.PNG)
img_stream.seek(0)

img = presentation.images.add_image(img_stream)

frame = slide.shapes.add_ole_object_frame(
    20, 100, 144, 144,
    "Excel.Sheet.12",
    excel_file_name
)
frame.substitute_picture_format.picture.image.replace_image(img)
frame.update_automatic = True

@sukritisehgal,
Thank you for the code example. I’ll need a little time to investigate the issue and will get back to you promptly.