Hello, we noticed a problem with Aspose.Words versions 24.12 and 25.2 which were not present in 24.9. Using the newest version when importing rotated shapes (excluding 0 or 180 degrees) X, Y coordinates are shifted by constant value (x + constant, y - constant).
Here are the examples, I provided a short code snippet to reproduce the issue together with results:
Code snippet:
Document document = new Document(fileStream);
Rectangle2D bounds =((Shape)
((GroupShape) document
.getSections()
.get(0)
.getBody()
.getParagraphs()
.get(1)
.getFirstChild())
.getFirstChild())
.getBoundsInPoints()
// Evaluate bounds...
Aspose.Words 24.9 result:
bounds = java.awt.geom.Rectangle2D$Float[
x=142.60002,
y=134.33392,
w=131.82613,
h=57.58661]
Aspose.Words 24.12, 25.2 result:
bounds = java.awt.geom.Rectangle2D$Float[
x=97.25003,
y=179.67593,
w=131.85452,
h=57.574203]
I attached the .docx document used in the examples bellow:
absolute_block_group_rotation (1).docx (17.9 KB)
Thank you!
@dfinsolutions
It seems you are experiencing an issue with the coordinates of rotated shapes when importing from DOCX files using Aspose.Words versions 24.12 and 25.2, which was not present in version 24.9. The coordinates for the X and Y positions of these shapes appear to be consistently shifted by a constant value when the shapes are rotated at angles other than 0 or 180 degrees.
To troubleshoot this issue, you might want to consider the following steps:
-
Check for Updates: Ensure that you are using the latest version of Aspose.Words, as the issue may have been addressed in a subsequent release after 25.2.
-
Review the Code: The code snippet you provided retrieves the bounds of a shape. Make sure that the shape’s properties are set correctly before calling getBoundsInPoints()
. You might want to log the properties of the shape before and after rotation to see if any unexpected changes occur.
-
Test with Different Shapes: Try using different types of shapes or different rotation angles to see if the issue persists across all shapes or is specific to certain types.
-
Contact Support: If the problem continues, consider reaching out to Aspose support with a detailed description of the issue, including the specific DOCX file you are using, the code snippet, and the results you are observing. This will help them to reproduce the issue and provide a more targeted solution.
-
Check Documentation: Review the Aspose.Words documentation for any notes on handling rotated shapes or known issues with specific versions.
If you have any further questions or need additional assistance, feel free to ask!
Sources:
@dfinsolutions
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27896
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issues you have found earlier (filed as WORDSNET-27896) have been fixed in this Aspose.Words for .NET 25.4 update also available on NuGet.