Hyperlinks im Bereich abrufen
Contents
[
Hide
]
Hyperlinks im Bereich abrufen
Die Klasse Range bietet eine Hyperlinks-Eigenschaft, die alle Hyperlinks im ausgewählten Bereich zurückgibt. Sie können auch den Hyperlink durch Aufruf der Methode Hyperlink.Delete löschen.
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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string sourceDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
//Output directory | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Instantiate a Workbook object | |
// Open an Excel file | |
Workbook workbook = new Workbook(sourceDir + "HyperlinksSample.xlsx"); | |
// Get the first (default) worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Create a range A2:B3 | |
Range range = worksheet.Cells.CreateRange("A2", "B3"); | |
// Get Hyperlinks in range | |
Hyperlink[] hyperlinks = range.Hyperlinks; | |
foreach (Hyperlink link in hyperlinks) | |
{ | |
Console.WriteLine(link.Area + " : " + link.Address); | |
// To delete the link, use the Hyperlink.Delete() method. | |
link.Delete(); | |
} | |
workbook.Save(outputDir + "HyperlinksSample_out.xlsx"); |