我正在description
使用 docx4j 修改停靠文件的标签,如下所示:
DocPropsCorePart docPropsCorePart = wordMLPackage.getDocPropsCorePart();
CoreProperties coreProps = (CoreProperties)docPropsCorePart.getJaxbElement();
JAXBElement<SimpleLiteral> desc = coreProps.getDescription();
SimpleLiteral literal = (SimpleLiteral) XmlUtils.unwrap(desc);
if (literal!=null) {
List<String> contents = literal.getContent();
contents.add(0, "Scanned by AFTA. Request Code: ${scanCode}");
}
else {
//comes here when document has no description tag
}
//save the document
但是,某些文档没有description
标签。我想将描述标签添加到这些文档中。我怎样才能做到这一点?