Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to append poi excel files?

807605Jul 20 2007 — edited Jul 20 2007
Hi All,
I am using POI excel files and this is my code to create an excel sheet.
for(i=0;i<i<files.length();i++)
{
 String excel=excelFiles[i]
 Date date=  new Date();
  int  rowCount= 45;
Sample samp=new Sample();
samp.createWorkbookForLogReport(excel,date,rowCount);
 }

    private HSSFWorkbook createWorkbookForLogReport(String excel,Date date,int rowCount) throws IOException {

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("new sheet");

        int idx = 0; // rows index
        HSSFRow row = sheet.createRow((short)idx);
        idx++;
        String[] attributessss = 
        { "ExcelName", "Date and Time", "RowCount" };

        for (int j = 0; j < attributessss.length; j++) {
            attribute = attributessss[j];
            row.createCell((short)j).setCellValue((String)attribute);
        }

                 
            row = sheet.createRow((short)idx);
            row.createCell((short)0).setCellValue((String)excelFiles);
            row.createCell((short)1).setCellValue(date);
            row.createCell((short)2).setCellValue(rowCount);


            idx++;
     
        return wb;


    }


the parametres are continuously changing i am able to write once in the excel file.but couldnt able to append the same excel file.is there any possibility to append the single excel file for changing records. 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2007
Added on Jul 20 2007
1 comment
429 views