编辑工作表的超链接
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"); |