检查XWPFRun高亮 [英] Check if XWPFRun is highlighted

查看:465
本文介绍了检查XWPFRun高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Apache POI,我读Word文档,无论是DOC和DOCX。老CharacterRun的文档具有isHighlighted功能,它告诉我,如果文本被高亮与否。是否有XWPFRun同等功能的docx文件?

For Apache POI, I am reading Word documents, both doc and docx. The old CharacterRun for doc has an isHighlighted function that tells me if text is highlighted or not. Is there an equivalent function for XWPFRun for docx files?

推荐答案

大量的研究和分析后,我能找出存在的CTRPr类的功能。

After a lot of research and analysis, I was able to figure out there is a function in the CTRPr class.

//p is the XWPFParagraph
for (XWPFRun pRun : p.getRuns()) {
   CTRPr ctrpr = pRun.getCTR().getRPr();
   if (ctrpr != null && ctrpr.isSetHighlight()) { 
      //This is highlighted
   }
}

这篇关于检查XWPFRun高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆