ワークシートのハイパーリンクを編集
Contents
[
Hide
]
Aspose.Cellsを使用して、Worksheet.Hyperlinksコレクションを介してワークシートのすべてのハイパーリンクにアクセスできます。このコレクションから各ハイパーリンクにアクセスし、そのプロパティを編集することができます。
ワークシートのハイパーリンクの編集
以下のサンプルコードは、ワークシートのすべてのハイパーリンクにアクセスし、それらのHyperlink.AddressプロパティをAsposeのウェブサイトに変更します。
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 | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(EditingHyperlinksOfWorksheet.class); | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
for (int i = 0; i < worksheet.getHyperlinks().getCount(); i++) { | |
Hyperlink hl = worksheet.getHyperlinks().get(i); | |
hl.setAddress("http://www.aspose.com"); | |
} | |
workbook.save(dataDir + "output.xlsx"); |