Picture in TableCell to maintain proportions?

Hi!
I added a picture to a table cell with

final IPPImage imgEx = workingSlide.getPresentation().getImages().addImage(img);
cell.getFillFormat().setFillType(FillType.Picture);
cell.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);

as there is no PictureFillMode like “keepProportions” or something like that, I need to do this in another way without cutting off parts of the image.
In Powerpoints itself there’s the option to set a crop factor (see image attachment - sorry it’s german). How can I do this with Aspose.slides?

Best regards,
Christiane

Hi Christiane,


I have observed the requirement shared in attached image and regret to share that at present the requested support is unavailable in Aspose.Slides. An issue with ID SLIDESJAVA-35272 has been created in our issue tracking system as new feature request to further investigate the possibility of implementing requested support. This thread has been linked with the issue so that you may be automatically notified once the requested support will be available.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-35272) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Is there a solution to this issue yet?

Hi Ashwin,

I have observed your inquiry and like to share that similar post has been shared by you in another forum thread as well and response has been shared with your over this forum link.

Many Thanks,

With the other forum, the image doesn’t retain its size and is stretched out within the table cell. I was wondering if there is a way to maintain the properties of the image within the cell so it is not stretched out? (And not using tile either).

Hi Ashwin,


I have observed your comments. Can you please share used sample code, source presentation and generated presentation with us. Also please share desired output so that we can further investigate to help you out.

Best Regards,
IPPImage imgx1 = destPres.getImages().addImage(new FileInputStream(new File("C:/Users/Ashwin Sundaram/Documents/Test/circle.PNG")));

//Add image to first table cell
tbl.get_Item(2, 1).getFillFormat().setFillType(FillType.Picture);
tbl.get_Item(2,1).getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);
tbl.get_Item(2, 1).getFillFormat().getPictureFillFormat().getPicture().setImage(imgx1);

However, the image in the cell is stretched out completely in order to fill up the entire cell. Is there a way to insert the image into the cell but not have it stretched out to fit the entire cell?

Hi Ashwin,

I have observed the sample code shared by you and suggest you to please try using following alternate code for cropping image on your end to serve the purpose. I hope this will be helpful. If there is still an issue then please share the sample source presentation, generated presentation and desired output presentation. We will be able to investigate the issue further on our end once requested information will be shared.

final IPPImage imgEx = workingSlide.getPresentation().getImages().addImage(img);
cell.getFillFormat().setFillType(FillType.Picture);
cell.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);

//Crop the image
cell.getFillFormat().getPictureFillFormat().setCropLeft(-30f);
cell.getFillFormat().getPictureFillFormat().setCropRight(-30f);

Many Thanks,

With that solution, the background of that cell then becomes white despite the rest of the table being a different color. Is there any solution to that as of now?

Hi Ashwin,


I have observed your comments. I like to inform that the shared solution is available option w.r.t option available in PowerPoint. If you are able to achieve that in PowerPoint then share a sample presentation with desired effects and we will investigate that further on our end.

Best Regards,