Hi Pierre,
I have a excel file which is created using MS Excel application. I am trying
to read and do some modification in this file using POI. I have facing some
problem in that.
I am using the following code, to add comments to a already existing cell in
a sheet.
In the same sheet, i also have a cell which acts as a drop down ( I mean a
cell with data validation type list and referring a named range).
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();
Finally after writing the file to a new location, when i open the file and
see, the data in the drop down is lost and i am not getting the drop down
arrow also.
Can you please help me on this.
If you need any information, please let me know.
--
with thanks,
krishnanand.