我正在尝试使用Apache POI创建单元格注释。我已经成功创建了注释,但是默认情况下它们始终显示在Excel中。我必须手动右键单击单元格并取消选中“显示批注”以使它们不可见(现在它们仅在鼠标悬停在单元格上时出现)。是否有可能使单元格注释默认情况下不可见(因此在用户将鼠标悬停在单元格上之前它们不会出现在Excel中)?
这是我使用的代码:
这是我使用的代码:
Drawing drawing = cell.getSheet().createDrawingPatriarch();
CreationHelper factory = cell.getSheet().getWorkbook().getCreationHelper();
ClientAnchor anchor = factory.createClientAnchor();
anchor.setCol1(cell.getColumnIndex());
anchor.setCol2(cell.getColumnIndex() + 1);
anchor.setRow1(cell.getRowIndex());
anchor.setRow2(cell.getRowIndex() + 3);
Comment comment = drawing.createCellComment(anchor);
RichTextString str = factory.createRichTextString(message);
comment.setVisible(Boolean.FALSE);
comment.setString(str);
cell.setCellComment(comment);