在使用C++将Excel保存为HTML时禁用Downlevel Revealed Comments

可能的使用场景

将Excel文件保存为HTML时,Aspose.Cells显示了下层条件注释。这些条件注释主要与旧版本的Internet Explorer相关,与现代网页浏览器无关。你可以在以下链接详细了解它们。

Aspose.Cells允许你通过将HtmlSaveOptions.GetDisableDownlevelRevealedComments()属性设置为true来消除这些下层显示的注释。

在保存为HTML时禁用下级可见的批注

以下示例代码展示了HtmlSaveOptions.GetDisableDownlevelRevealedComments()属性的用法。截图显示了当未将此属性设置为true时的效果。请下载此代码中使用的样本Excel文件以及它生成的输出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 workbook
    U16String sourceDir(u"..\\Data\\01_SourceDirectory\\");
    U16String outputDir(u"..\\Data\\02_OutputDirectory\\");

    Workbook wb(sourceDir + u"sampleDisableDownlevelRevealedComments.xlsx");

    // Disable DisableDownlevelRevealedComments
    HtmlSaveOptions opts;
    opts.SetDisableDownlevelRevealedComments(true);

    // Save the workbook in html
    wb.Save(outputDir + u"outputDisableDownlevelRevealedComments_true.html", opts);

    std::cout << "Workbook saved successfully with DisableDownlevelRevealedComments enabled!" << std::endl;

    Aspose::Cells::Cleanup();
}