Aggiungere collegamenti ipertestuali alle celle
Aggiungi collegamenti ipertestuali alle celle
Il seguente codice di esempio mostra come aggiungere un collegamento ipertestuale all’interno della cella del foglio di lavoro. Puoi anche aggiungere un collegamento ipertestuale in un intervallo di celle in modo simile. Si prega di controllare il file excel di output generato con questo codice e la seguente schermata che mostra il file excel di output in Microsoft Excel.
Codice di Esempio
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of input | |
U16String dirPath(u""); | |
//Path of output | |
U16String outPath(u""); | |
//Path of output excel file | |
U16String outputAddHyperlinksToTheCells = outPath + u"outputAddHyperlinksToTheCells.xlsx"; | |
//Create a new workbook | |
Workbook workbook; | |
//Get the first worksheet | |
WorksheetCollection wsc = workbook.GetWorksheets(); | |
Worksheet ws = wsc.Get(0); | |
//Add hyperlink in cell C7 and make use of its various methods | |
HyperlinkCollection hypLnks = ws.GetHyperlinks(); | |
int idx = hypLnks.Add(u"C7", 1, 1, u"http://www.aspose.com/"); | |
Hyperlink lnk = hypLnks.Get(idx); | |
lnk.SetTextToDisplay(u"Aspose"); | |
lnk.SetScreenTip(u"Link to Aspose Website"); | |
//Save the workbook | |
workbook.Save(outputAddHyperlinksToTheCells); | |
Aspose::Cells::Cleanup(); |