You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by krishnanand thiyadath <at...@gmail.com> on 2008/09/05 17:03:53 UTC
regarding adding comments and drop down
Hi Guys,
I am reading an excel file and trying to add coments to some of the cells
in the sheet.
In the sheet, i have cells (named cells) which has list of values, from
which we can select any one (drop down).
When i add comments, the drop down cells are converted in to normal cells
with single value.
I am using the following code
File f = new File(filePath);
FileInputStream fis = new FileInputStream(f);
POIFSFileSystem fs = new POIFSFileSystem(fis);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFPatriarch patr = sheet.createDrawingPatriarch();
HSSFCell cell = sheet.getRow(1).getCell(1);
HSSFComment comment = patr.createComment(new HSSFClientAnchor(0, 0, 0, 0,
(short)1, 2, (short) 2, 4));
comment.setString(new HSSFRichTextString("Comments Added"));
cell.setCellComment(comment);
FileOutputStream fos = new FileOutputStream(new
File("D://temp//test.xls"));
wb.write(fos);
fos.close();
can any one please help me out. I am attching the excel file screen shots
along with this mail.
--
with thanks,
krishnanand.