Apache POI PPT Creating Hyperlinks Apache POI PPT

How to create hyperlinks Apache POI PPT?

This chapter will give you detailed description on how to create hyperlinks in a presentation.

Creating Hyperlinks

You can read the hyperlinks in a presentation using createHyperlink() method of the XSLFTextRun class. Follow below procedure for creating a hyperlink in a presentation.

Create an empty presentation using the XMLSlideShow class as shown below:

Create an empty slide and create a textbox and body of the slide using body and content layout.

Create a text run object and set text to it as shown below:

Create a hyperlink using createHyperlink() method of the XSLFTextRun class as shown below:

Set the link address to the hyperlink using setAddress() method of XSLFHyperlink class as shown below:

Save the above Java code as CreatingHyperlinks.java and then compile and execute it from the command prompt as shown below:

It will compile and execute to generate below output:

Newly added slide with the hyperlink in its body looks as shown below:

create hyper

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache POI PPT Topics