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
- Start JReport Designer and open the report in which you want to insert some rotated text.
- On the menu bar, click Insert > UDO.
- In the Insert UDO dialog, select JRotator from the drop-down list, and then click OK.
- Keep the JRotator focused and go to the Report Inspector.
- 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.
- 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.
- Save the report.
Using JRotator to rotate an image
- Start JReport Designer and open the report in which you want to insert a rotated image.
- On the menu bar, click Insert > UDO.
- In the Insert UDO dialog, select JRotator from the drop-down list, and then click OK.
- Keep the JRotator focused and go to the Report Inspector.
- 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.
- 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.
- Resize the JRotator container as needed to view the entire image.
- Save the report.
Using JRotator to rotate a DBField
- Start JReport Designer and open the report in which you want to insert a rotated DBField.
- On the menu bar, click Insert > UDO.
- In the Insert UDO dialog, select JRotator from the drop-down list, and then click OK.
- Keep the JRotator focused and go to the Report Inspector.
- 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.
- 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.
- Change the size of the JRotator container as needed to view the entire text.
- Save the report.