简体   繁体   中英

How to set text font using Apache POI PPT API?

I am using Apache POI PPT API to create PPTX. I want to apply specific font family to text I have added in slide.

I have explore API and found only following method to specify color and font size, but no idea on how to set font family, Please help.

XSLFTextRun run1 = paragraph.addNewTextRun();
run1.setText("This is test"); 
run1.setFontColor(java.awt.Color.red);      
run1.setFontSize(24);    
 XSLFTextRun run1 = p.addNewTextRun(); 
       run1.setText("This is test"); 
       run1.setFontFamily(HSSFFont.FONT_ARIAL);
       run1.setFontColor(Color.red);    
       run1.setFontSize(24);  

You can use the setFontFamily method to specify the font family

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM