Hi,

i have to update periodicaly an excel file and insert comments as well.


The code goes like this:
- read already existing excelfile
- get sheet
- create patriarch
- create rows, columns
- create comment
- set comment

If i insert a comment then i loose the comments which the excel file
already contained. In the documentation i've found that calling the
createDrawingPatriarch method destroys all drawings previously created.
I guess this is why i loose the comments.

The questions: how can i insert a comment without loosing the
previously  created comments? Is there a method to a get a reference to
a HSSFPatriarch without creating a new one?

thanks,


the code:

try {

    in = new FileInputStream(this.reportfile);
    wb = new HSSFWorkbook(in);
    
    /* first set the data in the Reporte sheet */
    report_sheet = wb.getSheet("Reporte");
    patr = report_sheet.createDrawingPatriarch();
    
    
    /* create rows, cells 
    .
    .
    .*/
    
    /* set comment */
    prov_comment = patr.createComment(new HSSFClientAnchor(0, 0, 0, 0,
(short)4, 2, (short) 8, 7));
    prov_comment.setString(new HSSFRichTextString("Comment");
    row[0].getCell(short(2)).setCellComment(prov_comment);
        
    
    //write out excel
    out = new FileOutputStream(reportfile);
    wb.write(out);
    out.close();
    
} catch (IOException ioe) {
    log.error(ioe);
} catch (Exception e){
    log.error(e);
    e.printStackTrace();
}




      
____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

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

Reply via email to