Convertir Excel a HTML con tooltip usando C++
Convertir Excel a HTML con tooltip
Podría haber casos en los que el texto se corte en el HTML generado y desees mostrar el texto completo como tooltip al pasar el cursor. Aspose.Cells soporta esto proporcionando la propiedad HtmlSaveOptions.GetAddTooltipText(). Establecer la propiedad HtmlSaveOptions.GetAddTooltipText() en true añadirá el texto completo como tooltip en el HTML generado.
La siguiente imagen muestra el tooltip en el archivo HTML generado.
El siguiente ejemplo carga el archivo fuente de Excel y genera el archivo HTML de salida con el tooltip.
Código de muestra
#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();
}