Esporta le proprietà del documento, del workbook e del foglio di lavoro nella conversione Excel in HTML con C++

Possibili Scenari di Utilizzo

Quando un file Microsoft Excel viene esportato in HTML usando Microsoft Excel o Aspose.Cells, vengono esportate anche varie tipologie di proprietà del Documento, del Workbook e del Foglio di lavoro, come mostrato nella schermata successiva. È possibile evitare di esportare queste proprietà impostando HtmlSaveOptions.GetExportDocumentProperties(), HtmlSaveOptions.GetExportWorkbookProperties() e HtmlSaveOptions.GetExportWorksheetProperties() su false. Il valore predefinito di queste proprietà è true. La schermata seguente mostra come appaiono in HTML esportato.

todo:image_alt_text

Esporta proprietà del Documento, del Workbook e del Foglio di lavoro nella conversione Excel in HTML

Il codice di esempio di seguito carica il file Excel di esempio e lo converte in HTML senza esportare le proprietà di Documento, Cartella di Lavoro e Foglio di Lavoro nell'output HTML.

Codice di Esempio

#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\\");

    // Path of input Excel file
    U16String inputFilePath = srcDir + u"sampleExportDocumentWorkbookAndWorksheetPropertiesInHTML.xlsx";

    // Path of output HTML file
    U16String outputFilePath = outDir + u"outputExportDocumentWorkbookAndWorksheetPropertiesInHTML.html";

    // Load the sample Excel file
    Workbook workbook(inputFilePath);

    // Specify Html Save Options
    HtmlSaveOptions options;

    // We do not want to export document, workbook and worksheet properties
    options.SetExportDocumentProperties(false);
    options.SetExportWorkbookProperties(false);
    options.SetExportWorksheetProperties(false);

    // Export the Excel file to Html with Html Save Options
    workbook.Save(outputFilePath, options);

    std::cout << "Excel file exported to HTML successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}