我有一个Microsoft单词(.docx)文件并尝试检索注释及其关联的突出显示文本。你能帮忙吗?
附加示例word文档的图片和用于提取评论的java代码。 [带有“我的名字是约翰”一行的文件。单词“John”以注释“Noun”]
突出显示我能够提取评论(名词,形容词)。我想提取与评论“Noun”相关联的文本(Noun = John,Adjective = great)
FileInputStream fis = new FileInputStream(new File(msWordFilePath));
XWPFDocument adoc = new XWPFDocument(fis);
XWPFWordExtractor xwe = new XWPFWordExtractor(adoc);
XWPFComment[] comments = adoc.getComments();
for(int idx=0; idx < comments.length; idx++)
{
MSWordAnnotation annot = new MSWordAnnotation();
annot.setAnnotationName(comments[idx].getId());
annot.setAnnotationValue(comments[idx].getText());
aList.add(annot);
}[enter image description here][1]