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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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
}
}