GroupDocs.Annotation for Java 让标注 Excel 电子表格变得轻松:
- 使用 Annotator 实例打开 Excel 文件。
- 创建并配置所需的批注。
- 将批注添加到电子表格中。
- 保存已标注的 Excel 文件。
GroupDocs.Annotation for Java 让标注 Excel 电子表格变得轻松:
// 标注 Excel 电子表格
// 使用 Annotator 实例打开电子表格
Annotator annotator = new Annotator("input.xlsx");
try {
// 创建区域批注
AreaAnnotation area = new AreaAnnotation();
area.setBox(new Rectangle(100, 100, 200, 80));
area.setBackgroundColor(65535);
area.setPageNumber(0);
area.setMessage("Important");
// 添加批注
annotator.add(area);
// 保存已标注的电子表格
annotator.save("annotated.xlsx");
} finally {
annotator.dispose();
}
向 Excel 电子表格添加所有批注类型,并使用简洁的 API 进行管理。

在 Excel 文件中突出显示、下划线、删除线或替换文本。
在 Excel 工作表上绘制形状并添加水印或图像。
获取、删除、导入和导出 Excel 批注。
// 打开已注释的电子表格
Annotator annotator = new Annotator("annotated.xlsx");
try {
// 获取所有注释
List<AnnotationBase> annotations = annotator.get();
// 检查每个注释
for (AnnotationBase annotation : annotations) {
System.out.println(annotation.getMessage());
}
// 保存电子表格
annotator.save("output.xlsx");
} finally {
annotator.dispose();
}