TextRun[] txt = slide[j].getTextRuns();
for (int k = 0; k < txt.length; k++) {
String text = txt[k].getText();
Hyperlink[] links = txt[k].getHyperlinks();
if(links != null) for (int l = 0; l < links.length; l++) {
Hyperlink link = links[l];
String title = link.getTitle();
String address = link.getAddress();
System.out.println(" " + title);
System.out.println(" " + address);
String substring = text.substring(link.getStartIndex(), link.getEndIndex()-1);//in ppt end index is inclusive
System.out.println(" " + substring);
}
}
//in PowerPoint you can assign a hyperlink to a shape without text,
//for example to a Line object. The code below demonstrates how to
//read such hyperlinks
System.out.println(" reading hyperlinks from the slide's shapes");
Shape[] sh = slide[j].getShapes();
for (int k = 0; k < sh.length; k++) {
Hyperlink link = sh[k].getHyperlink();
if(link != null) {
String title = link.getTitle();
String address = link.getAddress();
System.out.println(" " + title);
System.out.println(" " + address);
}
}
}