如何使用 Apache POI PPT API 设置文本高亮?
How to set text hightlight using Apache POI PPT API?
我正在使用apache poi处理ppt.I可以通过CTRegularTextRun的getRPr()方法获取CTRegularTextRun的CTTextCharacterProperties,然后我可以在接口CTTextCharacterProperties中找到setHighlight(CTColor var1)方法,但是我不知道如何使文本内容成为 highlighted.does 谁能帮助我?
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);
}
我正在使用apache poi处理ppt.I可以通过CTRegularTextRun的getRPr()方法获取CTRegularTextRun的CTTextCharacterProperties,然后我可以在接口CTTextCharacterProperties中找到setHighlight(CTColor var1)方法,但是我不知道如何使文本内容成为 highlighted.does 谁能帮助我?
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);
}