Hello All,

I want to add comments to over1024 cells.
but I cannot add comments.

so, I checked source HSSFShape.java setShapeId() method.
CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)
_objRecord.getSubRecords().get(0);
cod.setObjectId((short) (shapeId%1024));
The maximum ObjectId of this function can be set is 1023.

The HSSF Sheet can not add a comment more than 1024.
It's specification?


I'm using POI 3.9.

try {
 InputStream is= new FileInputStream("test.xls");
 Workbook workbook = WorkbookFactory.create(is);
 is.close();
 Sheet sheet = workbook.getSheet("Sheet1");

 CreationHelper ch = workbook.getCreationHelper();
 ClientAnchor anchor = ch.createClientAnchor();
 Drawing drawing = sheet.createDrawingPatriarch();

 int z=0;
 for (int r=1; r<201; r++) {
  Row row = sheet.getRow(r);
  for (int c=1; c<11; c++) {
   Cell cell = row.getCell(c);
   if (cell == null) {
    cell = row.createCell(c);
   }
   Comment newComment = drawing.createCellComment(anchor);
   newComment.setString(ch.createRichTextString("comment"));
   cell.setCellComment(newComment);
  }
 }

 FileOutputStream os = new FileOutputStream("res.xls");
 workbook.write(os);
 os.close();
} catch (Exception e) {
}

Thanks,

Arimitsu


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to