Align an image in a cell to center it both vertically and horizontally in Java

Hi Team,

I’ve a scenario in which the image in a particular cell to be aligned center (both vertically and horizontally).

Existing Scenario :
image.png (10.5 KB)

Required Scenario :
image.png (8.9 KB)

Could you please help me with some sample java code to achieve this.

Thanks in advance,


Thanks for the screenshots.

Please refer to this help topic:Managing Pictures. Picture/ Shape class offers setUpperDeltaX, setUpperDeltaY, setLeft and setTop methods and other attributes to accomplish the task. See the following code segment for your reference:
Sample code:

// Positioning the picture proportionally to row height and column width

// Absolute positioning of the picture in unit of pixels

By the way, you may create your sample Excel file manually using MS Excel with your picture on desired position and its size, now load it using Aspose.Cells and check different attributes so you may set these via code.