ツールチップ付きでExcelをHTMLに変換(C++使用)
Contents
[
Hide
]
ツールチップ付きでExcelをHTMLに変換する
生成されたHTMLでテキストが切り取られる場合に、ホバー時に完全なテキストをツールチップとして表示したいことがあります。Aspose.Cellsはこれをサポートしており、HtmlSaveOptions.GetAddTooltipText()プロパティを設定します。HtmlSaveOptions.GetAddTooltipText()プロパティをtrueに設定すると、完全なテキストをツールチップとして追加します。
次の画像は、生成されたHTMLファイル内のツールチップを示しています。
次のコードサンプルは、源となるExcelファイルを読み込み、ツールチップ付きの出力HTMLファイルを生成します。
サンプルコード
#include <iostream>
#include "Aspose.Cells.h"
#include "Aspose.Cells/HtmlSaveOptions.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
// Source directory path
U16String sourceDir(u"..\\Data\\01_SourceDirectory\\");
// Output directory path
U16String outputDir(u"..\\Data\\02_OutputDirectory\\");
// Open the template file
Workbook workbook(sourceDir + u"AddTooltipToHtmlSample.xlsx");
// Setup HTML save options
HtmlSaveOptions options;
options.SetAddTooltipText(true); // Enable tooltip text in output
// Save as HTML
workbook.Save(outputDir + u"AddTooltipToHtmlSample_out.html", options);
std::cout << "Workbook saved with tooltip text added!" << std::endl;
Aspose::Cells::Cleanup();
}