Node.js経由のC++を使ってワークブックの未使用リソースを解放

Contents
[ ]

Workbookオブジェクトは現在、System.IDisposableインターフェースを実装しており、単一のメソッドWorkbook.dispose()を持ちます。直接Workbook.dispose()メソッドを呼び出すか、Usingステートメントを使って自動的にこのメソッドを呼び出すことも可能です。

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Loads the workbook which contains hidden external links
const workbook = new AsposeCells.Workbook(filePath);

// Create workbook object
const wb1 = new AsposeCells.Workbook();

// Call Dispose method
wb1.dispose();

// Call Dispose method via a scoped approach
(async () => {
const wb2 = new AsposeCells.Workbook();
// Any other code goes here
wb2.dispose();
})();