Hi,
I am not able to find new lines in the generated excel sheet with the
below code
XSSFFont font1 = workbook.createFont();
font1.setBold(false);
font1.setColor(IndexedColors.BLACK.getIndex());
font1.setFontName("Arial");
font1.setFontHeight(8);
XSSFFont font2 = workbook.createFont();
font2.setBold(true);
font2.setColor(IndexedColors.BLACK.getIndex());
font2.setFontName("Arial");
font2.setFontHeight(11);
XSSFCellStyle cellStyle= workbook.createCellStyle();
cellStyle.setFillForegroundColor(new XSSFColor(new Color(255, 255, 255)));
cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
cellStyle.setWrapText(true); // Please note wrap text was enabled
cellStyle.setAlignment(CellStyle.ALIGN_LEFT);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setVerticalAlignment(VerticalAlignment.TOP);
Cell cell = row.createCell(0);
cell.setCellStyle(cellStyle);
XSSFRichTextString text = new XSSFRichTextString();
text.append("Test", font1);
text.append("\n new line", font2);
// -- Even tried with text.append(System.getProperty("line.separator"),
font2);
cell.setCellValue(text);
Can any one please help me
out on how to get new lines in the cells in this scenario.
Thanks in advance
Regards,
SV