Pregunta

i have created new row then merge two cells then i want to get this merged cell to put value in it

my code :

        sheet.createRow(1);
    HSSFRow row2 = sheet.getRow(1);
    HSSFCell cell = row2.getCell(1);
    cell.setCellValue("معلومات الطالب");
    sheet.addMergedRegion(CellRangeAddress.valueOf("A2:B2"));

but i get error java.lang.NullPointerException

¿Fue útil?

Solución

You have to create the cell using row2.createCell(1) before setting the value.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top