HyperlinkTargetFrame Class
Contains names of predefined target frames for hyperlinks that open a URI.
Declaration
public class HyperlinkTargetFrame extends JavaObject
Remarks
Pass a HyperlinkTargetFrame field to the HyperlinkAction.createUri(uri, targetFrame) method to specify the frame or window in which the URI opens. You can also pass a custom frame name.
Call the UriHyperlinkAction.getTargetFrame() method to get the target frame of an existing hyperlink.
Refer to the following help topic for additional information: Work with Shapes — Presentation API for Java.
Example
Add Hyperlinks to Shapes on a Slide
The following code snippet adds shapes with hyperlinks to a slide. The hyperlinks open a web page, create an email message, move to another slide, and end the slide show:
import java.io.*;
import java.nio.file.*;
import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;
public class Main {
public static void main(String[] args) throws Exception {
try (Presentation presentation = new Presentation()) {
presentation.getSlides().clear();
Slide menuSlide = new Slide(SlideLayoutType.BLANK);
Slide summarySlide = new Slide(SlideLayoutType.BLANK);
presentation.getSlides().add(menuSlide);
presentation.getSlides().add(summarySlide);
// Open a web page in a new browser window.
OfficeHyperlink webLink = new OfficeHyperlink(HyperlinkAction.createUri("https://www.devexpress.com", HyperlinkTargetFrame.BLANK));
webLink.setToolTip("Visit the DevExpress website");
addLinkedShape(menuSlide, "DevExpress Website", webLink, 100);
// Create an email message with the specified subject.
addLinkedShape(menuSlide, "Contact Us",
new OfficeHyperlink(HyperlinkAction.createEmail("info@example.com", "Product question")), 450);
// Move to the second slide.
addLinkedShape(menuSlide, "Summary",
new OfficeHyperlink(HyperlinkAction.createSlideJump(summarySlide)), 800);
// End the slide show.
addLinkedShape(menuSlide, "Exit", new OfficeHyperlink(HyperlinkAction.getEndShow()), 1150);
Files.createDirectories(Path.of("output"));
try (OutputStream stream = Files.newOutputStream(Path.of("output", "Document.pptx"))) {
presentation.save(stream);
}
}
}
static void addLinkedShape(Slide slide, String text, OfficeHyperlink hyperlink, float y) {
Shape shape = new Shape(ShapeType.getRectangle(), 100, y, 1200, 250);
shape.setName(text);
shape.getTextArea().setText(text);
shape.setHyperlink(hyperlink);
slide.getShapes().add(shape);
}
}
Inherited Members
Inheritance
HyperlinkTargetFrame()
Initializes a new instance of the HyperlinkTargetFrame class.
Declaration
public HyperlinkTargetFrame()
Fields
BLANK Field
The target frame name for a new window.
Declaration
public static final String BLANK
Field Value
| Type | Description |
|---|---|
| String | The target frame name, |
PARENT Field
The target frame name for the parent frame.
Declaration
public static final String PARENT
Field Value
| Type | Description |
|---|---|
| String | The target frame name, |
SELF Field
The target frame name for the frame that contains the hyperlink.
Declaration
public static final String SELF
Field Value
| Type | Description |
|---|---|
| String | The target frame name, |
TOP Field
The target frame name for the full window outside all frames.
Declaration
public static final String TOP
Field Value
| Type | Description |
|---|---|
| String | The target frame name, |