I tried using the code from the "Busy Developers Guide" to make an XLSX file
with comments. Excel doesn't show the comments but the comments are contained in
the underlying xml files. Can anyone run my code an tell me if I'm doing
something wrong or if this is really a bug?
I'm using 3.5 Beta 6.
public static void main(String[] args) throws Exception {
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet("Cell comments in POI XSSF");
CreationHelper createHelper = wb.getCreationHelper();
XSSFCell cell1 = sheet.createRow(3).createCell((short)1);
cell1.setCellValue(new XSSFRichTextString("Hello, World"));
XSSFComment comment1 = sheet.createComment();
comment1.setString("We can set comments in POI");
comment1.setAuthor("Apache Software Foundation");
comment1.setVisible(true);
Cell.setCellComment method
cell1.setCellComment(comment1);
XSSFComment comment2 = sheet.createComment();
comment2.setString(createHelper.createRichTextString(
"Comment for missing cell"));
comment2.setAuthor("Apache POI");
comment2.setRow(11);
comment2.setColumn((short)1);
comment2.setVisible(true);
FileOutputStream out = new
FileOutputStream(
"C://eclipseWS//HaykUtil//spreadsheets//poi_comment.xlsx");
wb.write(out);
out.close();
System.out.println("Done");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]