Exportera dokumentbok och kalkylbladsattribut i Excel till HTML omvandling

Möjliga användningsscenario

När en Microsoft Excel-fil exporteras till HTML med Microsoft Excel eller Aspose.Cells, exporteras även olika typer av dokument-, arbetsboks- och kalkylbladsattribut, som visas i följande skärmbild. Du kan undvika att exportera dessa egenskaper genom att ställa in HtmlSaveOptions.GetExportDocumentProperties(), HtmlSaveOptions.GetExportWorkbookProperties() och HtmlSaveOptions.GetExportWorksheetProperties() till false. Standardvärdet är true. Följande skärmbild visar hur dessa egenskaper ser ut i exporterad HTML.

todo:image_alt_text

Exportera dokument-, arbetsboks- och kalkylbladsattribut i Excel till HTML-omvandling

Följande exempel kod laddar exempel-Excel-filen och konverterar den till HTML utan att exportera dokument-, arbetsboks- och kalkylbladsattribut i utdata-HTML.

Exempelkod

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