Set the Comment of Table or List Object inside the Worksheet with Node.js via C++
Contents
[
Hide
]
You can set the comment of the Table or List Object inside the worksheet using the ListObject.getComment() property. The comment will be visible inside the xl/tables/tableName.xml file.
Set the Comment of Table or List Object inside the Worksheet
The following sample code loads the source excel file, sets the comment of the first table or list object inside the worksheet.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Open the template file.
const workbook = new AsposeCells.Workbook(path.join(dataDir, "table_comment.xlsx"));
// Access first worksheet.
const worksheet = workbook.getWorksheets().get(0);
// Access first list object or table.
const 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(path.join(dataDir, "SetCommentOfTableOrListObject_out.xlsx"), AsposeCells.SaveFormat.Xlsx);