This article demonstrate how to add hyperlinks to a PowerPoint slide using Spire.Presentation for Java.
import com.spire.presentation.*;
import com.spire.presentation.drawing.FillFormatType;
import java.awt.geom.Rectangle2D;
public class AddHyperlink {
public static void main(String[] args) throws Exception {
//Create a Presentation instance
Presentation presentation = new Presentation();
//Add a shape
Rectangle2D.Double rec = new Rectangle2D.Double(presentation.getSlideSize().getSize().getWidth() / 2 - 255, 120, 300, 150);
IAutoShape shape = presentation.getSlides().get(0).getShapes().appendShape(ShapeType.RECTANGLE, rec);
shape.getFill().setFillType(FillFormatType.NONE);
shape.getLine().setWidth(0);
shape.getTextFrame().getParagraphs().clear();
//Add some paragraphs with hyperlinks to the shape
ParagraphEx para1 = new ParagraphEx();
PortionEx tr1 = new PortionEx();
tr1.setText("Spire.Presentation for Java");
tr1.getClickAction().setAddress("https://www.e-iceblue.com/Introduce/presentation-for-java.html");
tr1.setLatinFont(new TextFont("Lucida Sans Unicode"));
tr1.setFontHeight(20);
para1.getTextRanges().append(tr1);
shape.getTextFrame().getParagraphs().append(para1);
shape.getTextFrame().getParagraphs().append(new ParagraphEx());
ParagraphEx para2 = new ParagraphEx();
PortionEx tr2 = new PortionEx();
tr2.setText("Spire.Presentation for .NET");
tr2.getClickAction().setAddress("https://www.e-iceblue.com/Introduce/presentation-for-net-introduce.html");
tr2.setLatinFont(new TextFont("Lucida Sans Unicode"));
tr2.setFontHeight(20);
para2.getTextRanges().append(tr2);
shape.getTextFrame().getParagraphs().append(para2);
//Save the document
presentation.saveToFile("AddHyperlink.pptx", FileFormat.PPTX_2010);
}
}
Output:

