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

Free Support Forum - aspose.com

Losing colours when exporting a Chart to EMF

Given this attachment:
Screen Shot 2022-10-28 at 1.20.45 PM.png (399.7 KB)
The left image is being exported as an EMF file, the right image as a PNG.

Why are the colours so different? Shouldn’t be the same?

public static void main(String[] args) throws Exception {
    var wb = new Workbook("/Users/perez/EmbeddedObject_03.xls");
    var chart = wb.getWorksheets().get(0).getCharts().get(0);
    var imgOpts = new ImageOrPrintOptions();

    try (var stream = new ByteArrayOutputStream()) {
        chart.toImage(stream, imgOpts);
        var sheet = wb.getWorksheets().add("chart-image");
                new ByteArrayInputStream(stream.toByteArray()),


EmbeddedObject_03.xls.zip (5.5 KB)


Thanks for the template file and screenshot.

Please notice, I am able to reproduce the issue as you mentioned by rendering the chart to EMF image type. I found colors are lost when exporting the chart to EMF, it works fine if we use PNG image format type. I have a ticket with an id “CELLSJAVA-44942” for your issue. We will investigate and look into the details of the issue.

Once we figure it out or we have some other updates, we will let you know.

Hello @Amjad_Sahi - do we have any update on this?


The issue is related to write Emf image records in Java. It is complex to fix it.
However, we’re working on improving Java Emf image generating. If we have some progress. we will update you.


We are pleased to inform you that your issue has been resolved now. The fix will be included in our upcoming release (Aspose.Cells v23.1) which is scheduled in the second week of January 2023. You will be notified once the next release is published.

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