使用C++导出Web浏览器不支持的类似边框样式

可能的使用场景

微软Excel支持一些虚线边框类型,但Web浏览器不支持。当你用Aspose.Cells将此类Excel文件转为HTML时,这些边框会被移除。除了移除,Aspose.Cells还支持显示这些边框,通过设置HtmlSaveOptions.GetExportSimilarBorderStyle()属性为true,支持显示未支持的边框,导出到HTML。

在Web浏览器不支持边框样式时导出相似的边框样式

以下示例加载了包含一些不支持边框的示例Excel文件,调用效果如截图所示。截图进一步展示了HtmlSaveOptions.GetExportSimilarBorderStyle()属性在输出HTML中的效果。

todo:image_alt_text

示例代码

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C

    // Load the sample Excel file
    U16String inputFilePath(u"sampleExportSimilarBorderStyle.xlsx");
    Workbook workbook(inputFilePath);

    // Specify Html Save Options - Export Similar Border Style
    HtmlSaveOptions opts;
    opts.SetExportSimilarBorderStyle(true);

    // Save the workbook in Html format with specified Html Save Options
    U16String outputFilePath(u"outputExportSimilarBorderStyle.html");
    workbook.Save(outputFilePath, opts);

    std::cout << "Workbook saved successfully in HTML format with similar border styles!" << std::endl;

    Aspose::Cells::Cleanup();
}