C++ ile ODS Dosyalarında Hücre Doğrulamasını Alın

ODS Dosyalarında Hücre Doğrulamasını Al

Aspose.Cells for C++ ile, ODS dosyalarında bir hücreye uygulanan doğrulamayı alabilirsiniz. Bu API, GetValidation metodunu Cell sınıfında sağlar.

Aşağıdaki kod örneği, source ODS dosyasını yükleyerek ve A9 hücresinin doğrulamasını okuyarak GetValidation metodunu nasıl kullanacağınızı gösterir.

Örnek Kod

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Source directory path
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Load source Excel file
    U16String inputFilePath = srcDir + u"SampleBook1.ods";
    Workbook workbook(inputFilePath);

    // Access first worksheet
    WorksheetCollection worksheets = workbook.GetWorksheets();
    Worksheet worksheet = worksheets.Get(0);

    // Access cell A9
    Cells cells = worksheet.GetCells();
    Cell cell = cells.Get(U16String(u"A9"));

    // Check validation existence
    Validation validation = cell.GetValidation();
    if (validation.IsNull() == false)
    {
        std::cout << "Validation type: " << static_cast<int>(validation.GetType()) << std::endl;
    }

    Aspose::Cells::Cleanup();
    return 0;
}