Set the Comment of Table or List Object
Contents
[
Hide
]
Set the Comment of Table or List Object inside the Worksheet
Aspose.Cells for Python via Java supports adding the comment of List Object. For this, the API provides the ListObject.Comment property. The comment added by the ListObject.Comment property will be visible inside the xl/tables/tableName.xml file.
The following screenshot shows the comment created by the sample code in the red rectangle.
The following sample code loads the source excel file, sets the comment of the first table or list object inside the worksheet
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") |