Prevent Exporting Hidden Worksheet Contents on Saving to HTML with Node.js via C++
Contents
[
Hide
]
You can save Excel workbooks to HTML. However, if the workbook contains hidden worksheets, Aspose.Cells by default exports the hidden worksheet contents to the HTML output (_files) directory which contains files such as worksheets, images, tabstrip.htm, stylesheet.css, etc. Sometimes, exporting the content of the hidden worksheets this way isn’t appropriate. For example, if the hidden worksheet contains images that should not be exported to the _files directory.
Aspose.Cells for Node.js via C++ provides the HtmlSaveOptions.getExportHiddenWorksheet() property. By default, it is set to true and hidden worksheets are exported to HTML. If you set it false, Aspose.Cells will not export hidden worksheet contents.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create workbook object
const workbook = new AsposeCells.Workbook(path.join(dataDir, "WorkbookWithHiddenContent.xlsx"));
// Do not export hidden worksheet contents
const options = new AsposeCells.HtmlSaveOptions();
options.setExportHiddenWorksheet(false);
// Save the workbook
workbook.save(path.join(dataDir, "HtmlWithoutHiddenContent_out.html"), options);