Hi, I have a problem using POI with a excel file.

I start making a file copy and creating the POIFSFileSystem for the OUT
File.

        String slINPathName = AORConstants.getFolderPath() +
AORConstants.getExcelEmptyTemplName();
        String slOUTPathName = AORConstants.getFolderPath() + "Work file " +
                            AORConstants.getExcelFileUrl();

        copyFiles(slINPathName, slOUTPathName);

        POIFSFileSystem objlPOIFileSys = 
                new POIFSFileSystem(new FileInputStream(slOUTPathName));

Next, I create the HSSFWorkbook object and get a sheet of it:

        HSSFWorkbook objlHSSFWb = new HSSFWorkbook(objlPOIFileSys);
        HSSFSheet objlHSSFSheet = objlHSSFWb.getSheet("Input");

Next, I get a particular row and cell and set a new value:

        HSSFRow objlHSSFRow = objlHSSFSheet.getRow(1);
      HSSFCell objlHSSFCell = objlHSSFRow.getCell(2);
        objlHSSFCell.setCellValue("PPP1");

and finally write the book:

        FileOutputStream objlfileOut = new FileOutputStream(slOUTPathName);
      objaHSSFWb.write(objlfileOut);
      objlfileOut.close(); 
        objlfileOut = null;

The original file's size is: 1775KB but, after write, the file's size is
2292KB and when I try open it I got : "File error: data may have been lost"
and my excel breaks.

What do am I doing wrong ???

Thanks for your help.

Notes:
- This is happenin with POI 2.5.1 and 1.5.1
- If you need the complete java source and the excel file for tests I can
provide you.

Thanks again

Javier Perez Sanabria
        


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to