إضافة الارتباطات الفرعية إلى الخلايا
Contents
[
Hide
]
إضافة الارتباطات الفرعية إلى الخلايا
يوضح الكود المثالي التالي كيفية إضافة الارتباط داخل الخلية في ورقة العمل. يمكنك أيضًا إضافة ارتباط في مجموعة من الخلايا بطريقة مماثلة. يرجى التحقق من ملف إكسل الناتج الذي تم إنشاؤه باستخدام هذا الكود ولقطة الشاشة التالية التي تظهر ملف إكسل الناتج في Microsoft Excel.
الكود المثالي
This file contains 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
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(); |