Flip the text in Word using Java with the help of the step-by-step process given in this article. It also contains information to set the development environment and a sample code to change text direction in Word using Java. You will also learn to rotate the text in a given direction according to your requirements.
Steps to Rotate Word Page using Java
- Set the environment to use Aspose.Words for Java to flip text
- Load the Word file using the Document object
- Iterate through all the sections in the document
- Convert the Object item to a section
- Set the text orientation of the section to UPWARD
- Save the resultant file with flipped text
These steps briefly discuss how to flip text in Word using Java. Start the process by loading the source Word file and iterating through all the sections in this file where an Object type entry is accessed from the SectionsCollection. Convert each Object to a Section and then change its text orientation using the setTextOrientation() method from the PageSetup object in a section.
Code to Flip Words in Word using Java
This code shows how to rotate a Word document 90 degrees using Java. You may change the direction of the text in any of the directions like HORIZONTAL that is the default setting, DOWNWARD, UPWARD, HORIZONTAL_ROTATED_FAR_EAST, VERTICAL_FAR_EAST, and VERTICAL_ROTATED_FAR_EAST. You may select multiple sections or a single selection for changing the text direction based on each iteration’s properties.
This article has taught us how to rotate a page in Word using Java. If you want to resize an image in a Word file, refer to the article on how to resize image in Word using Java.