ODSファイルでのセル検証の取得

ODS ファイルでのセル検証を取得

Aspose.Cells for Node.js via C++を使用して、ODSファイル内のセルに適用されたバリデーションを取得できます。これには、APIのCell.getValidation()メソッドをCellクラスで利用します。

次のコード例は、Cell.getValidation()メソッドを使用してsrc ODSファイルを読み込み、セルA9の検証を行う方法を示しています。

サンプルコード

const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const sourceDir = path.join(__dirname, "data");
// Load source Excel file
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "SampleBook1.ods"));
// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);
const cell = worksheet.getCells().get("A9");
if (cell.getValidation() !== null)
{
console.log(cell.getValidation().getType());
}