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

Free Support Forum - aspose.com

There is a problem in getting the location of irregular graphics through the aspese interface

There is a problem in getting the location of irregular graphics through the aspese interface,give an example,There is a static excel. The row index in the upper left corner of a shape should be 3, but the result obtained through the Aspose interface is 4
image.png (39.3 KB)
image.png (38.7 KB)

this is the excel and code:
EPPR_47668.zip (8.1 KB)

Workbook workbook = new Workbook("D://Aspose//EPPR_47668//EPPR_47668.xlsx");
ShapeCollection shapes = workbook.getWorksheets().get(0).getShapes();
Shape shape = shapes.get("连接符: 肘形 4");
System.out.println("UpperLeftRow:" + shape.getUpperLeftRow());

@xhaixia,
If you zoom in the shape in MS Excel, you can notice that the upper left is row 4 as in attached screenshot. UpperLeft.PNG (4.9 KB)

Let us know your feedback.

@xhaixia,

After further evaluation, we are able to reproduce the issue as you mentioned. We found an issue with obtaining the row index of the upper left corner of the shape. It should be 3, but the result obtained through the sample code is 4. The lower right row is fine which is 4.
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\EPPR_47668.xlsx");
        ShapeCollection shapes = workbook.getWorksheets().get(0).getShapes();
        com.aspose.cells.Shape shape = shapes.get("连接符: 肘形 4");
        System.out.println("UpperLeftRow:" + shape.getUpperLeftRow());//4 Not OK
        System.out.println("LowerRightRow:" + shape.getLowerRightRow());//4 OK

We have logged a ticket with an id “CELLSJAVA-43815” for your issue. We will look into it soon.

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

@xhaixia,

We evaluated your issue further.
At present, our UpperLeftRow, UpperLeftColumn, LowerRightRow, LowerRightColumn are determined according to the starting point and ending point coordinates of the shape drawn. This is consistent with the content of the Excel file. After opening the Excel file as a compressed package, the following content will be found in the drawing1.xml file (see the image for reference.
1.png (3.5 KB)

If the purpose is to obtain the position and size of the actual display area of the shape, these variables may not get the expected results.

The main reasons are as follows:

  1. For regular shapes, the starting point is the upper left corner and the end point is the lower right corner. For irregular shapes, the start and end positions are not always in the upper left and lower right corners.

  2. If the shape is in the group, there is no row and column information, only the offset relative to the upper left corner of the group. The offset information here records the offset value when the shape is not flipped or rotated. Therefore, UpperLeftRow, UpperLeftColumn, LowerRightRow and LowerRightColumn calculated by the offset value may not be consistent with the actual display.

We have plans to provide a method to obtain the actual area size and position of the shape, but this function is very complicated and is still under development.

We will notify you as soon as we make some progress.