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

在工作表中设置表格或列表对象的注释

Aspose.Cells for Python via Java 支持添加List Object的注释。为此,API 提供了ListObject.评论财产。添加的评论ListObject.评论属性将在xl/表/表名.xml文件。

以下屏幕截图显示了红色矩形中示例代码创建的评论。

待办事项:图片_替代_文本

下面的示例代码加载源文件, 设置工作表内第一个表格或列表对象的注释

source_directory = "Examples/SampleFiles/SourceDirectory/"
output_directory = "Examples/SampleFiles/OutputDirectory/"
workbook = Workbook(source_directory + "source.xlsx")
# Access first worksheet
worksheet = workbook.getWorksheets().get(0)
# Access first list object or table
listObj = worksheet.getListObjects().get(0)
# Set the comment of the list object
listObj.setComment("This is Aspose.Cells comment.")
# Save the excel file.
workbook.save(output_directory + "STheCofTOrListObject_out.xlsx")