How can I insert value in the cell with style using POI

102 views Asked by At

I'm trying to insert a String in the cell using Poi. The problem is that the excel file is not empty but some style already has been applied. The border of the cell I want to put the value has styled like the pic below.

enter image description here

Eventhough there is not any value in cells, console tell me that range of the border is already written. Also I considered using HSSFWorkbook instead of SXSSFWorkbook. However it seems more efficient to use SXSSF because I have to handle millions of data in another sheet of the same file.

enter image description here

If I use the empty sheet, the code works well. How can I solve this problem?

Here is my code.

    public SXSSFWorkbook selectCalculateResultExcelValue(SXSSFWorkbook wb, Map<String, Object> searchParam) {

      SXSSFSheet xSheet=null;
      xSheet = wb.getSheet("Sheet1");
      String data = "JEJU";
      Row bodyRow=null;
      bodyRow=xSheet.createRow(5);
      Cell bodyCell = bodyRow.createCell(0);
      bodyCell.setCellValue(data);

    return wb;
}
0

There are 0 answers