获取ODS文件中的单元格验证
Contents
[
Hide
]
获取ODS文件中的单元格验证
使用Aspose.Cells,您可以获取ODS文件中单元格的验证。为此,API提供了Cell类的GetValidation方法。
下面的代码示例演示了如何通过加载源ODS文件并读取单元格A9的验证来使用GetValidation方法。
示例代码
This file contains 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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
//Source directory | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
//Load source Excel file | |
Workbook workbook = new Workbook(sourceDir + "SampleBook1.ods"); | |
//Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
Cell cell = worksheet.Cells["A9"]; | |
if (cell.GetValidation() != null) | |
{ | |
Console.WriteLine(cell.GetValidation().Type); | |
} |