I have a following code where I am trying to add a value to an existing
sheet. But for some reason, it works on some cells and it doesnt for others.
I think its a format issue how do i know the format of the cell and figure
out the format setting?

try {
        String filename = "C:/m/util.xls";
        POIFSFileSystem fs  = new POIFSFileSystem(new
FileInputStream(filename));
        HSSFWorkbook wb = new HSSFWorkbook(fs);
        HSSFSheet sheet = wb.getSheetAt((short)0);
        int i = 17;
        HSSFRow row = sheet.getRow(i);
        HSSFCell cell = row.getCell((short) 1);
        cell.setCellValue("test!");
        FileOutputStream fileOut = new FileOutputStream(filename);
        fileOut = new FileOutputStream(filename);
        wb.write(fileOut);
        fileOut.close();
        }catch(Exception e) { e.printStackTrace(); }

some of the cells have same formatting but still it works on some cells and
it doesnt on others.

Reply via email to