3

#When i use SXSSF to write a file,it happend,but i don`t know why.Here is my code:#

SXSSFWorkbook workbook = new SXSSFWorkbook()
SXSSFSheet currentSheet = workbook.createSheet()
SXSSFRow row = sheet.createRow(0);
SXSSFCell cell = row.createCell(0);
cell.setCellValue( obj);

##Now,the log will show "SXSSF doesn't support Rich Text Strings, any formatting information will be lost".##

The Wind
  • 31
  • 2

1 Answers1

0

This log will keep printing, I don't know the exact fix for it but I found work around solution to avoid unnecessary logging.

Step 1: Create your own rich text method

protected XSSFRichTextString richTextString(Object object) {
    return new XSSFRichTextString((String) object);
}

Step 2: While assigning value to cell call the above method pass whatever object to it.

protected void addCell(Workbook workbook, Row row, Integer i, Object 
object) {
    Cell cell = row.createCell(i);
    cell.setCellValue(richTextString(object));   
 }