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

Free Support Forum - aspose.com

Set picture data wrong

Workbook wb = new Workbook("C:/Pic2.xlsx"); Worksheet worksheet = wb.getWorksheets().get(0); PictureCollection pictures = worksheet.getPictures(); for (int i = 0; i < pictures.getCount(); i++) { Picture picture = pictures.get(i); picture.setData(new byte[] { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, -60, -119, 0, 0, 0, 11, 73, 68, 65, 84, 120, -38, 99, 96, 0, 2, 0, 0, 5, 0, 1, -23, -6, -36, -40, 0, 0, 0, 0, 73, 69, 78, 68, -82, 66, 96, -126 }); } HtmlSaveOptions o = new HtmlSaveOptions(); o.setExportActiveWorksheetOnly(true); ImageOrPrintOptions io = o.getImageOptions(); io.setImageFormat(ImageFormat.getPng()); wb.save("C:/x.html", o);



Chart's background missing.

Hi,


Thanks for the template file and sample code.

After an initial test, I observed the issue as you mentioned by using your sample code with template file. I found that the chart’s background is missing after setting the picture’s data:
e.g
Sample code:

Workbook
wb = new Workbook(“Pic2.xlsx”);<o:p></o:p>

Worksheet worksheet = wb.getWorksheets().get(0);

PictureCollection pictures = worksheet.getPictures();

for (int i = 0; i < pictures.getCount(); i++)

{

Picture picture = pictures.get(i);

picture.setData(new byte[] { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, -60, -119, 0, 0, 0, 11, 73, 68, 65, 84, 120, -38, 99, 96, 0, 2, 0, 0, 5, 0, 1, -23, -6, -36, -40, 0, 0, 0, 0, 73, 69, 78, 68, -82, 66, 96, -126 });

}

HtmlSaveOptions o = new HtmlSaveOptions();

o.setExportActiveWorksheetOnly(true);

ImageOrPrintOptions io = o.getImageOptions();

io.setImageFormat(ImageFormat.getPng());

wb.save("f:\\files\\out1.html", o);

wb.save("f:\\files\\out2.xlsx");



I have logged a ticket with an id "CELLSJAVA-42324" for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

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