views:

350

answers:

1

How to rotate text which is there in HSSFCell class of Apache POI API?

Can you please provide some example code for the same?

+2  A: 

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();
myStyle.setRotation(90);

HSSFCell c = row.createCell(columnNumber);
c.setCellStyle(myStyle);
amischiefr
Thanks a lot ... I am able to rotate the cell text ...
Bihag Raval