I need to make text shows nice in xls document. I'm using spring mvc xml view with java. There is code sample:
CellStyle style = workbook.createCellStyle();
HSSFSheet sheet = workbook.createSheet("Test");
sheet.setDefaultColumnWidth(20);
int worCount = 1;
for (Object s : crimeCaseList) {
HSSFRow nRow = ud.createRow(rowCount++);
if(s.getClass().getName().equals("java.util.HashMap")) {
Map<String, Object> map = (HashMap<String,Object>)s;
nRow.createCell(0).setCellValue((map.get("rowNum")==null)?"":
map.get("rowNum").toString());
.....
}
}
So, I have a lot of columns and there could be much of text. I need to make it look nice. So, when text come to the end of column it needs to be transfer on new line automaticaly and row should be grow according to text length. How can I do it?