How to rotate text in a spreadsheet cell using Apache POI?

Tags: , , , ,

How can I rotate the text within an HSSFCell class of Apache POI?


Use HSSFCellStyle, that class has a method called setRotation(short rotation) which will rotate the text. All you do is apply the cell style to a cell:

HSSFCellStyle myStyle = workbook.createCellStyle();

HSSFCell c = row.createCell(columnNumber);

Source: stackoverflow