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();
imgOpts.setTransparent(true);
imgOpts.setImageType(ImageType.EMF);
try (var stream = new ByteArrayOutputStream()) {
chart.toImage(stream, imgOpts);
var sheet = wb.getWorksheets().add("chart-image");
sheet.getPictures().add(
0,
0,
new ByteArrayInputStream(stream.toByteArray()),
300,
300);
}
wb.save("/Users/perez/output.xlsx");
}
EmbeddedObject_03.xls.zip (5.5 KB)