문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top