设置表格或列表对象的注释

设置工作表内表格或列表对象的批注

请使用ListObject.Comment属性在工作表中设置表格或列表对象的注释。 注释将在xl/tables/tableName.xml文件中可见。

下面的示例代码加载了源Excel文件,设置了工作表中第一个表格或列表对象的注释,屏幕截图展示了此代码创建的注释。

todo:image_alt_text

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(SettheCommentofTableorListObject.class) + "tables/";
// Open the template file.
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Access first worksheet.
Worksheet worksheet = workbook.getWorksheets().get(0);
// Access first list object or table.
ListObject lstObj = worksheet.getListObjects().get(0);
// Set the comment of the list object
lstObj.setComment("This is Aspose.Cells comment.");
// Save the workbook in xlsx format
workbook.save(dataDir + "STheCofTOrListObject_out.xlsx", SaveFormat.XLSX);