Importer XML dans un classeur Excel avec C++

Importer une carte XML en utilisant Microsoft Excel

La capture d’écran suivante montre comment importer une carte XML en utilisant Microsoft Excel

todo:image_alt_text

Importer une carte XML en utilisant Aspose.Cells

Le code d’exemple suivant montre comment utiliser la méthode Workbook.ImportXml(). Il génère le fichier Excel de sortie comme montré dans cette capture d’écran.

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

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

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

    // Output directory path
    U16String outDir(u"..\\Data\\02_OutputDirectory\\");

    // Create a workbook
    Workbook workbook;

    // URL that contains your XML data for mapping
    U16String XML(u"http://www.aspose.com/docs/download/attachments/434475650/sampleXML.txt");

    // Import your XML Map data starting from cell A1
    workbook.ImportXml(XML, u"Sheet1", 0, 0);

    // Save workbook
    U16String outputPath = outDir + u"output_out.xlsx";
    workbook.Save(outputPath);

    std::cout << "Workbook saved successfully with imported XML data!" << std::endl;

    Aspose::Cells::Cleanup();
}

Sujets avancés