Converti Excel in HTML con tooltip usando C++
Convertire Excel in HTML con tooltip
Potrebbero esserci casi in cui il testo viene tagliato nell’HTML generato e vuoi visualizzare il testo completo come tooltip al passaggio del mouse. Aspose.Cells supporta questo fornendo la proprietà HtmlSaveOptions.GetAddTooltipText(). Impostare la proprietà HtmlSaveOptions.GetAddTooltipText() su true aggiungerà il testo completo come tooltip nell’HTML generato.
Nell’immagine seguente è mostrato il tooltip nel file HTML generato.
Il seguente esempio di codice carica il file Excel sorgente e genera il file HTML di output con il tooltip.
Codice di Esempio
#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();
}