Rotating text/image with JRotator

JRotator is used to rotate text or images. Since JReport currently supports rotating only images but not text, using JRotator to achieve text rotation becomes a feasible solution. JRotator rotates the text inside the JRotator object but not the object itself so if you rotate text or DBFields you may have to change the size of the container in order to see the full value.

The following introduces three cases of using JRotator:

Using JRotator to rotate text
  1. Start JReport Designer and open the report in which you want to insert some rotated text.
  2. On the menu bar, click Insert > UDO.
  3. In the Insert UDO dialog, select JRotator from the drop-down list, and then click OK.
  4. Keep the JRotator focused and go to the Report Inspector.
  5. Locate the Display Value property and type in the required text in the value cell, then click outside of the cell. You will then see the typed text displayed in the JRotator.
  6. Specify a rotation degree in the value cell of the Rotate property, for example, 180, then click outside of the cell. You will then find the text in the JRotator upside down.
  7. Save the report.
Using JRotator to rotate an image
  1. Start JReport Designer and open the report in which you want to insert a rotated image.
  2. On the menu bar, click Insert > UDO.
  3. In the Insert UDO dialog, select JRotator from the drop-down list, and then click OK.
  4. Keep the JRotator focused and go to the Report Inspector.
  5. Specify the local path of the required image in the value cell of the Display Image property, for example, C:\image.jpg, then click outside of the cell. You will then see the image displayed in the JRotator.
  6. Specify a rotation degree in the value cell of the Rotate property, for example, 45, then click outside of the cell. You will then find the image in the JRotator at a 45 degree angle.
  7. Resize the JRotator container as needed to view the entire image.
  8. Save the report.
Using JRotator to rotate a DBField
  1. Start JReport Designer and open the report in which you want to insert a rotated DBField.
  2. On the menu bar, click Insert > UDO.
  3. In the Insert UDO dialog, select JRotator from the drop-down list, and then click OK.
  4. Keep the JRotator focused and go to the Report Inspector.
  5. In the Display Value value cell, select the required DBField or create a formula for a calculated field and select the formula from the dropdown list. Then click outside of the cell and you will see the DBField displayed in the JRotator.
  6. Specify a rotation degree in the Rotate value cell, for example, 90, then click outside of the value cell. You will then find the DBField in the JRotator at a 90 degree angle.
  7. Change the size of the JRotator container as needed to view the entire text.
  8. Save the report.