Export Document Workbook and Worksheet Properties in Excel to HTML Conversion with C++

Possible Usage Scenarios

When a Microsoft Excel file is exported to HTML using Microsoft Excel or Aspose.Cells, it also exports various types of Document, Workbook, and Worksheet properties as shown in the following screenshot. You can avoid exporting these properties by setting the HtmlSaveOptions.GetExportDocumentProperties(), HtmlSaveOptions.GetExportWorkbookProperties(), and HtmlSaveOptions.GetExportWorksheetProperties() to false. The default value of these properties is true. The following screenshot shows how these properties look like in exported HTML.

todo:image_alt_text

Export Document, Workbook, and Worksheet Properties in Excel to HTML Conversion

The following sample code loads the sample Excel file and converts it to HTML without exporting the Document, Workbook, and Worksheet properties in the output HTML.

Sample Code

#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();
}