HTML mit C++

Excel-Arbeitsmappe in HTML konvertieren

Die API von Aspose.Cells bietet Unterstützung für den Export von Tabellenblättern in das HTML-Format. Für diesen Zweck verwendet Aspose.Cells die HtmlSaveOptions-Klasse, um die Flexibilität bei der Steuerung mehrerer Aspekte des HTML-Ausgangs zu gewährleisten.

Das unten stehende Codebeispiel zeigt, wie man eine Arbeitsmappe mit C++ als HTML-Datei speichert.

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

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

    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C

    // Load your source workbook
    Workbook workbook(u"Book1.xlsx");

    // Save file to HTML format
    workbook.Save(u"out.html");

    std::cout << "Workbook saved to HTML format successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}

Excel-Arbeitsmappe in MHTML-Dateien konvertieren

MHTML kombiniert normales HTML mit externen Ressourcen (also Inhalte, die gewöhnlich verlinkt sind, wie Bilder, Animationen, Audio usw.) in einer einzigen Datei. Sie werden für E-Mails mit der Erweiterung .mht verwendet. Aspose.Cells unterstützt das Lesen und Schreiben von MHTML-Dateien.

Das folgende Codebeispiel zeigt, wie man eine Arbeitsmappe mit C++ als MHTML-Datei speichert.

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

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

    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C

    // Load your source workbook
    U16String inputFilePath(u"Book1.xlsx");
    std::unique_ptr<Workbook> workbook = std::make_unique<Workbook>(inputFilePath);

    // Save file to mhtml format
    U16String outputFilePath(u"out.mht");
    workbook->Save(outputFilePath, SaveFormat::MHtml);

    std::cout << "Workbook saved to MHTML format successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}

Erweiterte Themen