Change in shapes background when inserting Excel saved EMF images into Powerpoint and printing to PDF

We are currently evaluating Aspose.Cells library v.23.7.2 and noticed the change in generated EMF images when inserting Excel named ranges as images into PowerPoint slide and printing them to PDF.
The change caused background of some shapes in an image to be changed from white to black.
This did not occur with the production version Aspose.Cells 21.3 we are using, nor with Aspose.Cells up to version 22.11, but started happening since 22.12.
Is this a known issue / behavior?
Is there a workaround that can be applied?
Attached is a zip file containing the following:

  • Small sample program creating EMF image from Worksheet named range “Pie_Chart_2_and_3” (feel free to try other named ranges);
  • VariousCharts.xlsx - input Excel Workbook
  • Various output EMF images created with different versions of Aspose Cells library - named VariousCharts.xlsx_Pie_Chart_2_and_3_CellsXX.Y.Z.emf
  • PowerPoint and PDF files with consumed EMF image, illustrating the problem.

This is reproducible in both Windows 10 and Linux 7 OS environments.
Please let us know if you need anything else.
Thank you.
AsposeCells_changed_shapes_background_in_PDF.7z (268.7 KB)

@oraspose,

Thanks for the template XLSX file.

I am able to reproduce the issue as you mentioned by using your template XLSX file. I noticed the change in generated EMF images when inserting Excel named ranges as images into PowerPoint slide and printing them to PDF. I am not sure if rendering of previous versions was right or newer versions render to EMF rightly. We need to investigate your issue in 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): CELLSJAVA-45530

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.

@oraspose

It seems it is caused by the changing of background of generated Emf image. We changed the default background from transparent to white in order to be consistent with Aspose.Cells for .NET.

You can use ImageOrPrintOptions.setTransparent to set background to transparent.

Workbook wb = loadWorkbookAsBytes(WORKBOOK_WITH_NAMED_RANGES);

final ImageOrPrintOptions imgOrPrintOptions = new ImageOrPrintOptions();
imgOrPrintOptions.setImageType(ImageType.EMF);
imgOrPrintOptions.setTransparent(true);
...

Hi Peyton.
Can you please elaborate on this:

We changed the default background from transparent to white

Why this change caused some of the shapes to be printed in PDF with white background (correct) and some - with black background (incorrect)?

You can use ImageOrPrintOptions.setTransparent to set background to transparent

How this affects if image in original source (excel template) does not have transparency set?

@oraspose

It seems that there is something in the genreated Emf image with default white background. Although, the Emf image looks good in Image Viewer or in Office PowerPoint, but when manually saving the pptx to pdf, Office PowerPoint reports an error.

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-45536

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.

@oraspose,

We are pleased to inform you that your issue (logged as “CELLSJAVA-45536”) has been resolved now. The fix will be included in an upcoming release (Aspose.Cells v23.8) that we plan to release in the first half of August 2023. You will be notified when the next version is released.

@oraspose

Please check the result with prefix: output_preview.zip (10.7 KB)

The generated Emf image with default white background works OK with Office PowerPoint and Aspose.Slides.

Verified the attached output EMF image allows to generate proper PDF after inserting into PowerPoint presentation. Both shapes are shown now with white background.
Thank you!

@oraspose,

Thanks for your feedback.

Hopefully the next version (which includes your fix) will be published in the next week.

Keep in touch.

The issues you have found earlier (filed as CELLSJAVA-45536) have been fixed in Aspose.Cells for Java 23.8.