Java doens';与Microsoft Excel一起使用后,无法识别Excel工作表中的注释字段
我正在使用ApachePOI创建Excel工作表。在该工作表中有一个带有注释的单元格。我可以用Java和Microsoft Excel阅读该评论。 如果我打开、更改某些内容并使用MicrosoftExcel2010保存工作表,Java(Apache)将不再识别注释字段。 问题是什么?如何解决 我创建这样的评论:Java doens';与Microsoft Excel一起使用后,无法识别Excel工作表中的注释字段,java,apache-poi,excel-2010,Java,Apache Poi,Excel 2010,我正在使用ApachePOI创建Excel工作表。在该工作表中有一个带有注释的单元格。我可以用Java和Microsoft Excel阅读该评论。 如果我打开、更改某些内容并使用MicrosoftExcel2010保存工作表,Java(Apache)将不再识别注释字段。 问题是什么?如何解决 我创建这样的评论: CreationHelper factory = wb.getCreationHelper(); Drawing drawing = sheet.crea
CreationHelper factory = wb.getCreationHelper();
Drawing drawing = sheet.createDrawingPatriarch();
// When the comment box is visible, have it show in a 5x70 space
ClientAnchor anchor = factory.createClientAnchor();
anchor.setCol1(cell.getColumnIndex());
anchor.setCol2(cell.getColumnIndex()+5);
anchor.setRow1(row.getRowNum());
anchor.setRow2(row.getRowNum()+70);
Comment comment = drawing.createCellComment(anchor);
String text = "";
RichTextString str = factory.createRichTextString(text);
comment.setString(str);
row.createCell(0).setCellComment(comment);
并阅读以下内容:
row_slave.getCell(0).getCellComment().getString()
谢谢我通过创建一个新单元解决了这个问题。 使用excel保存工作表后,Apache认为注释字段为空,因为没有其他内容(只有注释)。 如果我创建了一个新的单元格(row_slave.createCell(0)),注释仍然存在,可以读取