C++ ile WebQuery türündeki Dış Veri Bağlantısıyla Çalışma

WebQuery türündeki Harici Veri Bağlantısı ile Çalışma

Aşağıdaki kod, WebQuery türündeki harici veri bağlantısıyla nasıl çalışılacağını göstermektedir. İndirebileceğiniz örnek excel dosyası kullanılmaktadır. Ayrıca bu kodun konsol çıktısını aşağıda görebilirsiniz.

#include <iostream>
#include "Aspose.Cells.h"

using namespace Aspose::Cells;
using namespace Aspose::Cells::ExternalConnections;

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

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

    // Path of input excel file
    U16String inputFilePath = srcDir + u"WebQuerySample.xlsx";

    // Create workbook
    Workbook workbook(inputFilePath);

    // Get the first external connection from the workbook
    ExternalConnection connection = workbook.GetDataConnections().Get(0);

    // Check if the connection is a WebQueryConnection
    if (connection.GetClassType() == ExternalConnectionClassType::WebQuery)
    {
        // Cast to WebQueryConnection
        WebQueryConnection webQuery(connection);

        // Print the URL of the web query
        std::cout << "Web Query URL: " << webQuery.GetUrl().ToUtf8() << std::endl;
    }

    Aspose::Cells::Cleanup();
}

Konsol Çıkışı

Yukarıdaki kodun örnek excel dosyası‘nın konsol çıktısı aşağıda verilmiştir.

Web Query URL: https://docs.aspose.com/cells/net/