设置表格或列表对象的注释
Contents
[
Hide
]
设置工作表内表格或列表对象的批注
Aspose.Cells for Python via Java支持添加列表对象注释。为此,API提供了ListObject.Comment属性。由ListObject.Comment属性添加的注释将显示在xl/tables/tableName.xml文件内。
以下截图显示了样本代码在红色矩形内创建的注释。
以下样本代码加载了source excel file,设置了工作表内第一个表或列表对象的注释。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |