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

Free Support Forum - aspose.com

Dynamically place components in Excel Layout


Is there a way to place different components like grids/images in a excel layout with a given coordinates/width/height, using Aspose.Cells Java?

For example, FloatingBox in Aspose.PDF helps us to place components in a specified coordinates/width/height.



Thanks for your query.

Well, you may use Picture class attributes/methods to insert the image(s) into your respective cell(s) with your desired height and width, etc. See the document with examples and description for your reference:

Other drawing objects and controls (including Picture) do extend Shape class, so you may use the respective attributes/methods for other controls/shapes.


This is very helpful to place pictures/images, say I have collection of components like few grids/images. I have coordinates (x,y) and height/width for each component. Now is there a way to place each of them in respective coordinates?

Please let me know if I am not clear with my requirement.



Please check my previous reply and document to insert pictures or other drawing objects accordingly using different attributes of the Shape API. If you still find any issue in placing the drawing objects, kindly do provide a simple Excel file with some images/controls placed into different cells in the worksheet as per your needs, you may create the Excel file manually in MS Excel, we will check it soon.


Thanks for your help, I am able to insert pictures of jpeg’s in a specified location. I have attached the sample excel report, we are planning to generate.

There is no standard template in our report generation, I need to insert table/images according to components coordinates/height/width I receive as part of page layout information.

I am able to achieve this with Aspose PDF Java with Floating Box API. I just want to know, if similar kind of feature available in Aspose Cells Java?

Balakumarsample excel report.zip (24.7 KB)


Thanks for providing us sample file and further details.

I think there is no layout (e.g floating box, etc.) concept in MS Excel. If you know about it, let us know with details and give us steps involved on how to achieve this in MS Excel. Well, you have to insert data and pictures at your desired location in the worksheet manually via Aspose.Cells APIs, there may not be any other automatic way or alternative to do it.


Well, we did evaluate your requirements further. Please set Shape.LeftToCorner and TopToCorner attributes. See the following codes:
Sample code:

FileInputStream fs = new FileInputStream(“d://Filetemp//image1.png”);
int x = 100;
int y = 200;
ShapeCollection shapes = workbook.getWorksheets().get(0).getShapes();
Picture pic = shapes.addPicture(0, 0, 0, 0, fs);

Hope, this helps a bit.


In the above code, I need to do a small correction as follows:

//sample row and column values I have given below instead of zeroes…
Picture pic = shapes.addPicture(5, 5, 20, 20, fs);



Fantastic, am able to drop the image to a specific location in a sheet.

Is there a similar way to draw or drop a grid/table in a specified X,Y coordinates ??

Thanks for your help!



Good to know that your issue is sorted out now.

Regarding placement of grid/table, I think you meant ListObject/Table feature of MS Excel. Well, I am afraid, it may not be possible to provide such properties for Table/ListObject. As you know, Table/List Object is based on the cell, in contrast to shapes which can be floating over cells. So, you have to calculate the height of all the top rows and width of all the left column by yourself to determine which cell should be taken as the starting point according to the x,y coordinates you expect.