We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hyperlinks in Excel file

Hi Team,

I’m using Aspose Cells (Java) for reading hyperlinks in my excel file.
I’m using the below code, but unable to read hyperlinks in a SmartArt, Images, WordArt etc. I’m only able to parse hyperlinks in exact cells. Can you assist with me with ways to identify hyperlinks in other objects as well.

Also, can we identify if the hyperlink is Internal (pointing to a cell in same excel) or External?

Code Used

Workbook wb = new Workbook(dataDir + fileName);
wsCount = wb.getWorksheets().getCount();
for(int ws = 0; ws<wsCount; ws++){
Worksheet worksheet = wb.getWorksheets().get(ws);
hyperlinkCount = worksheet.getHyperlinks().getCount();
for(int i=0;i<hyperlinkCount;i++){
linkName = worksheet.getHyperlinks().get(i).getTextToDisplay();
linkURL = worksheet.getHyperlinks().get(i).getAddress();
System.out.println(removeSpecialChars(linkName)+ " - "+linkURL);

Sample File
testHyper2.zip (233.5 KB)



Please try the following code, it should help you get the hyperlink of any shape. The code works fine with your Excel file as I have tested it.


Workbook wb = new Workbook(dirPath + "testHyper2.xlsm");

Worksheet worksheet = wb.getWorksheets().get(1);

int cnt = worksheet.getShapes().getCount();

for(int i=0; i < cnt; i++)
	Shape sh = worksheet.getShapes().get(i);
	System.out.println("Shape Name: " + sh.getName());

Console Output

Shape Name: Diagram 1
Shape Name: Picture 3
Shape Name: Rectangle 4


Thanks for your response.
If you can notice, diagram1 is an smartart, which has 5 diagrams in it. Diagram1 has a hyperlink as well as 2/5 (last two) shapes have their own hyperlinks. I’m unable to read those hyperlinks.
Kindly suggest.



I think, your shape is Smart Art shape. We are afraid, Smart Art shapes are not supported at the moment.

When shape is a group shape, then you can get all the shapes using GroupShape.getGroupedShapes() method, it will return the array of all shapes inside the group shape.

Once, you get the shapes, you can access their hyperlinks with the code given to you in previous posts.

For Smart Art shapes, the issue has already been logged as

  • CELLSNET-40943 - Support SmartArt Shapes