Incorrect position of text boxes rotated to 90 and 270 deg after changing text wrap to NONE

Incorrect position of text boxes rotated to 90 and 270 deg after changing text wrap to NONE.

Code snippet:

      Document doc = new Document();
      DocumentBuilder builder = new DocumentBuilder(doc);

      builder.writeln("a line of text for reference");

      // Insert text boxes with different rotations and fill colors at the same position
      Shape textBoxShape1 = builder.insertShape(ShapeType.TEXT_BOX,
          RelativeHorizontalPosition.PAGE, 100,
          RelativeVerticalPosition.PAGE, 100,
          150, 100,
          WrapType.NONE);

      Shape textBoxShape2 = builder.insertShape(ShapeType.TEXT_BOX,
          RelativeHorizontalPosition.PAGE, 100,
          RelativeVerticalPosition.PAGE, 100,
          150, 100,
          WrapType.NONE);
      textBoxShape2.setFillColor(Color.RED);
      textBoxShape2.setRotation(90);

      Shape textBoxShape3 = builder.insertShape(ShapeType.TEXT_BOX,
          RelativeHorizontalPosition.PAGE, 100,
          RelativeVerticalPosition.PAGE, 100,
          150, 100,
          WrapType.NONE);
      textBoxShape3.setFillColor(Color.GREEN);
      textBoxShape3.setRotation(95);

      Shape textBoxShape4 = builder.insertShape(ShapeType.TEXT_BOX,
          RelativeHorizontalPosition.PAGE, 100,
          RelativeVerticalPosition.PAGE, 100,
          150, 100,
          WrapType.NONE);
      textBoxShape4.setRotation(270);
      textBoxShape4.setFillColor(Color.YELLOW);

      // Add text to each text box indicating its rotation
      builder.moveTo(textBoxShape1.getLastParagraph());
      builder.write("000deg");
      builder.moveTo(textBoxShape2.getLastParagraph());
      builder.write("090deg");
      builder.moveTo(textBoxShape3.getLastParagraph());
      builder.write("095deg");
      builder.moveTo(textBoxShape4.getLastParagraph());
      builder.write("270deg");

      // Set wrap mode to none for all text boxes
      textBoxShape1.getTextBox().setTextBoxWrapMode(TextBoxWrapMode.NONE);
      textBoxShape2.getTextBox().setTextBoxWrapMode(TextBoxWrapMode.NONE);
      textBoxShape3.getTextBox().setTextBoxWrapMode(TextBoxWrapMode.NONE);
      textBoxShape4.getTextBox().setTextBoxWrapMode(TextBoxWrapMode.NONE);

PDF export result:

  • with default (SQARE) AB text wrap:

  • with NONE AB text wrap

Aspose.WORDS version: 24.9

@dfinsolutions

Summary
There is no publicly available evidence confirming a bug in Aspose.Words 24.9 that causes text boxes rotated 90° or 270° to shift when their wrap mode is set to NONE. The information you provided appears to be a specific case that may be related to internal layout handling, but the retrieved sources do not mention this behavior.

Why it might happen

  • When a shape is rotated, the layout engine must recalculate its anchor point. If the wrap type is NONE, the engine may treat the shape differently because it is ignored for surrounding‑text flow. In some versions of Aspose.Words, this can lead to an incorrect anchor for rotations that swap width and height (90°/270°).
  • However, without concrete evidence (e.g., a bug report, release notes, or a forum post from Aspose) we cannot state definitively that this is a known issue in version 24.9.

What to do next

  1. Check the official release notes for Aspose.Words Java 24.9 and later versions. Look for any mention of fixes related to shape rotation, wrap types, or text‑box positioning.
  2. Test with a newer version (e.g., 25.x). If the problem disappears, it is likely a bug that has been fixed.
  3. Work‑around (if you must stay on 24.9):
  • Keep the external wrap type as WrapType.SQUARE (or another non‑NONE value) and use TextBoxWrapMode.NONE to control wrapping inside the text box.
  • If WrapType.NONE is required, manually adjust the shape’s Left and Top after setting the rotation to compensate for any offset. The exact offset will depend on the shape’s dimensions and may need trial‑and‑error tuning.
  1. Contact Aspose Support with a minimal reproducible example (the code you posted) and the PDF output you expect. They can confirm whether this is a known issue and suggest an official fix or workaround.
  2. Validate the result by rendering the document to PDF or DOCX after each change to ensure the text boxes appear at the intended coordinates.

If you obtain additional documentation or a bug‑track entry that specifically addresses this behavior, the answer can be refined accordingly.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

@dfinsolutions The problem is not reproducible on my side using the latest 25.10 version of Aspose.Words here are output PDF document produced on my side:
out_square.pdf (22.5 KB)
out_none.pdf (22.5 KB)

The position problem is still visible in both the screenshots you provided as the red box is shifted left/up and the yellow box is shifted left/down compared to the green one. The expectation is that the red and yellow text boxes will overlap and be roughly in the same position as the green one. See the original screenshot provided with square wrapping - all boxes are positioned identically relative to page, only their rotation angle is different.

@dfinsolutions Could you please save the expected output in DOCX and PDF format and attach the documents here for our reference? We will check the issue and provide you more information.

Please see attached DOCX and PDF exports for both SQUARE and NONE wrap types of the same code snippet. Note that in the NONE DOCX export the rotated boxes have not only shifted position in a different way, but also collapsed, but that seems to be a different issue.

none.docx (8.9 KB)

none.pdf (19.8 KB)

square.pdf (19.7 KB)

square.docx (8.9 KB)

@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-28813

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