Hello Aspose Team,
We have excel with multiple images. Sample excel file is attached here with name ‘WidgetAndAllCharts.xlsx’, in Display1 images are placed. These images are placed with following code.
Workbook workbook = new Workbook(“WidgetAndAllCharts.xlsx”)
Worksheet ws=workbook.worksheets.get(‘Dispaly1’)
Shape shape = ws.getShapes().get(“Section” + sectionValue + sectionPostFix) //getting shapes, sectionValue will be ‘1’ or ‘2’ to 36 and sectionPostFix will be ‘1x1’ or ‘2x2’ or ‘2x4’
int pictureIndex = ws.getPictures().add(shape.getUpperLeftRow(), shape.getUpperLeftColumn(), inputStream) //inputStream of respective image.
Picture picture = ws.getPictures().get(pictureIndex)
picture.setLeft(shape.getLeft())WidgetAndAllCharts.zip (678.4 KB)
picture.setTop(shape.getTop())
picture.setWidth(imgWidth)
picture.setHeight(imgHeight)
picture.setPlacement(shape.getPlacement())
And after placing the images we are saving this in .pdf with following code, Images layout will not be same as excel, layout. Space between widgets, size of images (width) are not as expected/similar as excel file. Could you please look into this from your side.
Workbook workbook = new Workbook(“WidgetAndAllCharts.xlsx”);
workbook.calculateFormula();
workbook.save(“myresult.pdf”); //used Display1 sheet