ODS ファイルで Cell 検証を取得する

ODS ファイルで Cell 検証を取得する

Aspose.Cells を使用すると、ODS ファイルのセルに検証を適用できます。このために、API はGetValidationの方法Cellクラス。

次のコード サンプルは、GetValidationをロードする方法ソース ODSファイルを開き、セル A9 の検証を読み取ります。

サンプルコード

// 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);
}