範囲内のハイパーリンクを取得
Contents
[
Hide
]
範囲内のハイパーリンクを取得
Rangeクラスは、選択した範囲内のすべてのハイパーリンクを取得するためのgetHyperlinks()プロパティゲッターを提供します。Hyperlink.delete()メソッドを呼び出すことで、ハイパーリンクを削除することもできます。
サンプルコード
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-Java | |
// Instantiate a Workbook object | |
// Open an Excel file | |
Workbook workbook = new Workbook(sourceDir + "HyperlinksSample.xlsx"); | |
// Get the first (default) worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Create a range A2:B3 | |
Range range = worksheet.getCells().createRange("A2", "B3"); | |
// Get Hyperlinks in range | |
Hyperlink[] hyperlinks = range.getHyperlinks(); | |
for (Hyperlink link : hyperlinks){ | |
System.out.println(link.getArea() + " : " + link.getAddress()); | |
// To delete the link, use the Hyperlink.Delete() method. | |
link.delete(); | |
} | |
workbook.save(outputDir + "HyperlinksSample_out.xlsx"); |