Free Support Forum - aspose.com

Layout API returns incorrect position for GroupShape and Shapes using Java

Dear support team,

In the attached document there are on the first page, 1 groupShape and 2 regular shapes (a textbox with 4, and an arrow connecting the textbox). These regular shapes are NOT part of the groupshape.

Looking at the shapes in the document, and their positions; I would expect that the regular shapes are overlapping with the group shapes.

However when executing the attached program (ShapePositionOnPage), you can see that the resulting Rectangles are not even intersecting.

Looking at the coordinates of the rectangles for the textbox and the arrow, it seems to me that the X-coordinate is completely offset.

This is the output when printing the resulting rectangles
Groupshape Location: java.awt.geom.Rectangle2D$Float[x=47.4,y=101.995,w=513.0,h=562.75]
Textbox Location: java.awt.geom.Rectangle2D$Float[x=583.999,y=240.583,w=39.05,h=22.5]
Arrow Location: java.awt.geom.Rectangle2D$Float[x=610.399,y=251.781,w=100.5,h=30.0]

Maybe there is a problem in the way I used to retrieve the absolute location of these shapes/groupshapes on the page. If so, could you please clarify what is the correct piece of code to use.

I’m using aspose for words java 20.3.

Many thanks for your support

Patrick
aspose-reporting.zip (92.2 KB)

@PatrickVB

We already logged a similar issue for your test case in this thread. We are unable to reproduce the shared issue in this thread at our end.

Could you please set the alternative text for problematic shapes and share the Word document here for testing?

Dear Tahir,

I do not completely agree that the other issue is a similar issue. Let me explain why. The other issue is about relative positions of child shapes within a groupshape.

This issue is about absolute positioning of unrelated toplevel shapes on the page. Complete different code is used for obtaining these element.

Could you please share here the output of running the attached application, similar as I did.
I do not understand how it could be that you would not have the same issue on your site.

Attached you can find as requested, the document with the two shapes having a alt text.
ARROW is the alt text of the arrow shape connecting the textbox.
TEXT_BOX_4 is the alt text of the text box.

I’m looking forward very much to see the output of my application on your end.

Many thanks

Patrick

ShapeLocationsOnPage.zip (215.1 KB)

Dear Tahir,

I understand what is the issue with not being able to reproduce the item.
I have uploaded the wrong zip file. The one for the previous time.
Please find attached here the correct one.

KR
Patrick

aspose-reporting.zip (232.4 KB)

@PatrickVB

The values return by LayoutEnumerator.Rectangle method are correct. This method returns the bounding rectangle of the current entity relative to the page top left corner.

We have logged this problem in our issue tracking system as WORDSNET-20194. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Dear Tahir,

I do not understand how you can conclude that the values are correct.

According to the documentation, the values are returned in points.

610 points corresponds roughly to 21.5 cm. That is even outside a regular A4 page.

Please provide some clarificaton on this subject.

Kind regards
Patrick

@PatrickVB

We have updated the issue in our our issue tracking system. We will inform you via this forum thread once there is an update available on this issue.

@PatrickVB

The latest version of Aspose.Words for Java 20.5 generates the correct output. So, please use the latest version of Aspose.Words for Java 20.5.

The issues you have found earlier (filed as WORDSNET-20194) have been fixed in this Aspose.Words for .NET 20.9 update and this Aspose.Words for Java 20.9 update.