Get Cell Validation in ODS Files
Contents
[
Hide
]
Get Cell Validation in ODS Files
With Aspose.Cells for Node.js via C++, you can get the validation applied to a cell in ODS files. For this, the API provides the Cell.getValidation() method of the Cell class.
The following code sample demonstrates the use of the Cell.getValidation() method by loading the source ODS file and reading the validation of the cell A9.
Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} |