This article describes the process to adjust row height in Excel using Java. It has the details to set the development environment, a list of steps to write the application, and a sample code to change height of row in Excel using Java. You will learn various methods to adjust the height of cells using different arguments.
Steps to Change Cell Height in Excel using Java
- Set the IDE to use Aspose.Cells for Java to adjust cells’ height
- Load the workbook and access a sheet to set the cell’s height
- Set the height of a particular row
- Autofit the height of cells in a range of columns for a specific row
- Adjust the height of a range of rows based on the contents
- Access another sheet and autofit all rows in a sheet
- Save the workbook with updated cells’ height
The above steps summarize the process to change Excel row height using Java. Start the process by loading the target workbook and a sheet with some text and calling different methods according to the requirement. Finally, save the resultant workbook with the adjusted height of cells in various sheets according to the requirements.
Code to Adjust Excel Row Height using Java
This sample code demonstrates how to adjust cell height in Excel using Java. It shares different methods for setting the height of cells for a particular row, autofit a row based on text in a range of columns, autofit a range of rows based on contents, and autofit all the rows in a sheet. Various overload methods are available using the AutoFitterOptions class that supports setting the flag to adjust merged cells, autofit the cells having wrapped text, the format strategy, ignore hidden rows and columns, and set the maximum row height while assigning the height.
This article guides how to adjust row height in Excel using Java. If you want to learn adjusting the columns’ height, refer to the article on how to adjust column width in Excel using Java.