在使用C++保存为HTML时,通过CrossHideRight隐藏覆盖内容

可能的使用场景

将Excel文件保存为HTML时,可以为单元格字符串指定不同的交叉类型。默认情况下,Aspose.Cells根据微软Excel生成HTML,但当你将交叉类型更改为CrossHideRight时,它会隐藏所有在单元格右侧被覆盖或重叠的字符串。

在保存为Html时使用CrossHideRight隐藏重叠内容

以下示例代码加载样本Excel文件,并在将HtmlSaveOptions.GetHtmlCrossStringType()设置为CrossHideRight后将其保存为输出HTML。截图说明了CrossHideRight如何影响默认输出的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 sample Excel file
    U16String sourceDir(u"..\\Data\\01_SourceDirectory\\");
    U16String outputDir(u"..\\Data\\02_OutputDirectory\\");
    Workbook wb(sourceDir + u"sampleHidingOverlaidContentWithCrossHideRightWhileSavingToHtml.xlsx");

    // Specify HtmlSaveOptions - Hide Overlaid Content with CrossHideRight while saving to Html
    HtmlSaveOptions opts;
    opts.SetHtmlCrossStringType(HtmlCrossType::CrossHideRight);

    // Save to HTML with HtmlSaveOptions
    wb.Save(outputDir + u"outputHidingOverlaidContentWithCrossHideRightWhileSavingToHtml.html", opts);

    std::cout << "File saved successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}