Aggiungi collegamenti ipertestuali allo Cells
Contents
[
Hide
]
Aggiungi collegamenti ipertestuali allo Cells
Il codice di esempio seguente 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 controllarefile excel di output generato con questo codice e la seguente schermata che mostra il file excel di output in Microsoft Excel.
Codice d’esempio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Path of output excel file | |
StringPtr outputAddHyperlinksToTheCells = outPath->StringAppend(new String("outputAddHyperlinksToTheCells.xlsx")); | |
//Create a new workbook | |
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(); | |
//Get the first worksheet | |
intrusive_ptr<IWorksheetCollection> wsc = workbook->GetIWorksheets(); | |
intrusive_ptr<IWorksheet> ws = wsc->GetObjectByIndex(0); | |
//Add hyperlink in cell C7 and make use of its various methods | |
intrusive_ptr<IHyperlinkCollection> hypLnks = ws->GetIHyperlinks(); | |
int idx = hypLnks->Add(new String("C7"), 1, 1, new String("http://www.aspose.com/")); | |
intrusive_ptr<IHyperlink> lnk = hypLnks->GetObjectByIndex(idx); | |
lnk->SetTextToDisplay(new String("Aspose")); | |
lnk->SetScreenTip(new String("Link to Aspose Website")); | |
//Save the workbook | |
workbook->Save(outputAddHyperlinksToTheCells); |