获取ODS文件中的单元格验证
Contents
[
Hide
]
获取ODS文件中的单元格验证
使用Aspose.Cells for Node.js via C++,你可以获取在ODS文件中应用到某个单元格的验证。API提供了Cell.getValidation()方法,属于Cell类。
以下代码示例演示了如何使用 Cell.getValidation() 方法加载 源 ODS 文件并读取单元格 A9 的验证。
示例代码
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()); | |
} |