导出边框样式(Web浏览器不支持的边框样式)使用Node.js通过C++
Contents
[
Hide
]
可能的使用场景
Microsoft Excel支持一些虚线边框类型,但Web浏览器不支持。当使用Aspose.Cells for Node.js via C++将此类Excel转换为HTML时,这些边框会被删除。但Aspose.Cells也支持显示此类边框,通过设置HtmlSaveOptions.getExportSimilarBorderStyle()属性,请将其值设为true,未支持的边框也会导出到HTML文件中。
在Web浏览器不支持边框样式时导出相似的边框样式
以下示例代码加载包含一些不支持的边框的示例Excel文件,如截图所示。截图还展示了HtmlSaveOptions.getExportSimilarBorderStyle()属性在输出HTML中的效果。
示例代码
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sampleExportSimilarBorderStyle.xlsx");
// Load the sample Excel file
const wb = new AsposeCells.Workbook(filePath);
// Specify Html Save Options - Export Similar Border Style
const opts = new AsposeCells.HtmlSaveOptions();
opts.setExportSimilarBorderStyle(true);
// Save the workbook in Html format with specified Html Save Options
wb.save("outputExportSimilarBorderStyle.html", opts);