This article demonstrates how to add a hyperlink that links to a specific slide within the presentation by using Spire.Presnetation for Java.
import com.spire.presentation.*; import com.spire.presentation.drawing.FillFormatType; import java.awt.geom.Rectangle2D; public class LinkToSpecificSlide { public static void main(String[] args) throws Exception { //Create a Presentation object Presentation presentation = new Presentation(); presentation.getSlideSize().setType(SlideSizeType.SCREEN_16_X_9); //Append a slide to it (there are two slides in the presentation including the default one) presentation.getSlides().append(); //Get the first slide ISlide firstSlide = presentation.getSlides().get(0); //Add a shape to it IAutoShape shape = firstSlide.getShapes().appendShape(ShapeType.RECTANGLE,new Rectangle2D.Float(10, 50, 200, 50)); shape.getFill().setFillType(FillFormatType.NONE); shape.getLine().setFillType(FillFormatType.NONE); //Add text to shape shape.getTextFrame().setText("Jump to the second slide"); //Set a hyperlink for the shape, linking to the second slide ClickHyperlink hyperlink = new ClickHyperlink(presentation.getSlides().get(1)); shape.setClick(hyperlink); shape.getTextFrame().getTextRange().setClickAction(hyperlink); //Save to another file presentation.saveToFile("LinkToSlide.pptx", FileFormat.PPTX_2013); } }