UriHyperlinkAction Class
A hyperlink action that opens a URI (for example, a web page, a file, or an email message).
Declaration
public class UriHyperlinkAction extends OfficeHyperlinkAction
Remarks
Call the following methods of the HyperlinkAction class to create a URI action:
- HyperlinkAction.createUri(uri)
- HyperlinkAction.createUri(uri, targetFrame)
- HyperlinkAction.createEmail(address)
- HyperlinkAction.createEmail(address, subject)
Example
Get Hyperlink Actions of Shapes on a Slide
The following code snippet loads a presentation and displays the action of each shape hyperlink on the first slide:
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 (InputStream stream = Files.newInputStream(Path.of("Document.pptx"));
Presentation presentation = new Presentation(stream)) {
for (ShapeBase shape : presentation.getSlides().getFirst().getShapes()) {
OfficeHyperlink hyperlink = shape.getHyperlink();
if (hyperlink == null)
continue;
String action = switch (hyperlink.getAction()) {
case UriHyperlinkAction uriAction -> "opens " + uriAction.getUri();
case SlideHyperlinkAction slideAction ->
"moves to slide " + (presentation.getSlides().indexOf(slideAction.getTargetSlide()) + 1);
case SlideShowHyperlinkAction showAction -> "performs the " + showAction.getJump() + " action";
default -> "performs an action that the API does not support";
};
System.out.println(shape.getName() + ": " + action);
}
}
}
}
Inherited Members
Inheritance
Methods
equals(Object obj) Method
Returns whether the specified object is equal to the current UriHyperlinkAction object.
Declaration
public boolean equals(Object obj)
Parameters
| Name | Type | Description |
|---|---|---|
| obj | Object | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| boolean |
|
Remarks
Two UriHyperlinkAction objects are equal if they have the same URI (getUri()) and target frame (getTargetFrame()).
getTargetFrame() Method
Returns the name of the frame or window in which the URI opens.
Declaration
public String getTargetFrame()
Returns
| Type | Description |
|---|---|
| String | The frame name, or |
Remarks
The frame name can be a HyperlinkTargetFrame field value (for example, _blank) or a custom frame name.
getUri() Method
Returns the URI that the hyperlink opens.
Declaration
public String getUri()
Returns
| Type | Description |
|---|---|
| String | The URI. |
hashCode() Method
Returns a hash code for this UriHyperlinkAction object.
Declaration
public int hashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code. |