[英]How to set text hightlight using Apache POI PPT API?
我正在使用apache poi處理ppt。我可以通過使用方法CTRegularTextRun的getRPr()獲取CTRegularTextRun的CTTextCharacterProperties,然后我可以在接口CTTextCharacterProperties中找到方法setHighlight(CTColor var1),但我不知道如何使文本內容突出顯示。有人可以幫助我嗎?
CTTextParagraph paragraph=new CTTextParagraph();
List<CTRegularTextRun> rList = paragraph.getRList();
for(CTRegularTextRun run:rList){
CTTextCharacterProperties rPr=run.getRPr();
CTColor ctColor=rPr.isSetHighlight()==true?rPr.getHighlight():rPr.addNewHighlight();
CTSRgbColor srgbClr=ctColor.isSetSrgbClr()==true?ctColor.getSrgbClr():ctColor.addNewSrgbClr();
byte[] rgbBytes = {(byte) Color.GREEN.getRed(), (byte) Color.GREEN.getGreen(), (byte) Color.GREEN.getBlue()};
srgbClr.setVal(rgbBytes);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.