Node.jsをC++経由で使用して、ワークシート内のテーブルまたはリストオブジェクトのコメントを設定する
Contents
[
Hide
]
Worksheet内のテーブルまたはリストオブジェクトのコメントは、ListObject.getComment()プロパティを使用して設定できます。コメントはxl/tables/tableName.xmlファイル内に表示されます。
ワークシート内のテーブルまたはリストオブジェクトのコメントを設定してください
以下のサンプルコードは、ソースエクセルファイルを読み込み、ワークシート内の最初のテーブルまたはリストオブジェクトのコメントを設定します。
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);