In this example we are going to create a PowerPoint slide and set color full title.
Make Colorful Title of PowerPoint Slide Using Java
<In this example we are going to create a PowerPoint slide and set color full title.
The methods used in this example:
getTextRuns():
This method is used to get blocks of text. The getTextAsString() and getTextAsVector() are two methods which are used to get the text back. The getTextAsString() returns a single string with all the text in it and getTextAsVector() returns a vector of strings, one for each text record found in the file. We can change the text via TextRun.setText(String) or RichTextRun.setText(String). But it is not yet possible to add additional TextRuns or RichTextRuns.
In this example we are using setFontColor(Color color) to change the color of text. The org.apache.poi.hslf.usermodel.RichTextRun class is used to change the textbox style, color, font size, font type etc. Here we are creating the object of RichText and then change the text textbox style, color, font size , font type etc.
The code of the program is given below:
import org.apache.poi.hslf.HSLFSlideShow;
|
The output of the program is given below: