Hi,
The code below produces a single text frame with a hyperlink in it. In PowerPoint 2000 it opens without error; in PowerPoint 2010 it open it in protected (sandbox) mode but with a warning that reads:
“PowerPoint has detected a problem with this file. Opening it may be dangerous. You should not open this file unless you trust it.”
I’m using Aspose Slides 2.4.0.
import com.aspose.slides.*;
import java.io.;
class Hyperlink {
public static void main(String[] args) {
try {
Presentation pres = new Presentation();
FileInputStream fistream = new FileInputStream(“Aspose.Total.Java.lic”);
License license = new License();
license.setLicense(fistream);
fistream.close();
Slide slide = pres.addEmptySlide();
Rectangle rect = slide.getShapes().addRectangle(2400,1800,1000,500);
TextFrame frame = rect.addTextFrame(“Hello world”);
frame.getParagraphs().clear();
Paragraph paragraph = new Paragraph();
Portion portion = new Portion();
portion.setText(“link”);
paragraph.getPortions().add(portion);
frame.getParagraphs().add(paragraph);
Link link = frame.getLinks().addLink();
link.setExternalHyperlink(“http://www.google.com”);
link.setBegin(0);
link.setEnd(4);
pres.getSlides().removeAt(0);
FileOutputStream fostream = new FileOutputStream(“test_hyperlink.ppt”);
pres.write(fostream);
fostream.close();
}
catch (Exception e) { System.out.println(“An error occurred”); }
}
}