我正在使用Apache POI PPT API创建PPTX。
我想对在幻灯片中添加的文本应用特定的字体系列。
我浏览了API,仅发现以下指定颜色和字体大小的方法,但对如何设置字体系列一无所知,请帮忙。
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);
您可以使用setFontFamily方法指定字体系列