我用ApachePOI来处理ppt,我可以用方法ctregulartextrun的getrpr()得到ctregulartextrun的cttextcharacterproperties,然后我可以在接口cttextcharacterproperties中找到方法sethighlight(ctcolor var1),但是我不知道如何突出显示文本内容,有人能帮我吗?
cedebl8k1#
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); }
1条答案
按热度按时间cedebl8k1#