hi Karl-Heinz,

Thanks for the prompt reply.Iam trying to read a simple excel file that contians a list.Iam using POI to read the excel file.I get exception.I wnat to read the fiel and add then write to that file.I need this functionality in my project.I tried doing it to a sample excel file.You said you have not used POI ?do u mean u have not used it to even read the excel file?Even iam using the latest POI version 2.5.
Iam sending you the client code and the sample excel fiel.coudl you help me out with this.
Thanks for the help
Kamala

-----------------------------------------------------------------------------
POIFSFileSystem fs  =new POIFSFileSystem(new FileInputStream("c:/excels/trialworkbook.xls"));
                       
                HSSFWorkbook wb = new HSSFWorkbook(fs);
                HSSFSheet sheet = wb.getSheetAt(0);
                HSSFRow row = sheet.getRow(5);
                HSSFCell cell = row.getCell((short)1);
                System.out.println("cell : "+cell);
                if (cell == null)
                {
                          System.out.println("inside if");        
                  cell = row.createCell((short)1);
                  cell.setCellType(HSSFCell.CELL_TYPE_STRING);
                  cell.setCellValue("test");
                }
                else
                        cell.setCellValue("test");
                      System.out.println(cell.getStringCellValue());
                      FileOutputStream fileOut = new FileOutputStream("c:/excels/trialworkbook.xls");
                wb.write(fileOut);
                fileOut.close();
                }catch(Exception e)
                {
                         System.out.println("Exception : "+e);
                         e.printStackTrace();            
                }
        }

Attachment: trialworkbook.xls
Description: MS-Excel spreadsheet

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

Reply via email to