Set the Comment of Table or List Object
Set the Comment of Table or List Object inside the Worksheet
Please set the comment of the Table or List Object inside the worksheet using the ListObject.Comment property. The comment will be visible inside the xl/tables/tableName.xml file.
The following sample code loads the source excel file, sets the comment of the first table or list object inside the worksheet and the screenshot shows the comment created by this code in the red rectangle.
// 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); |