我使用this example使用docx4j
获取所有合并字段使用此功能时,我会遇到异常情况。
我使用的是docx4j 3.1.0版本。我还使用了示例中给出的same file。
Exception in thread "main" java.lang.IllegalAccessError: tried to access class
org.apache.xml.serializer.ExtendedContentHandler from class
org.apache.xalan.transformer.TransformerImpl
at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1233)
at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1060)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1268)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251)
at org.docx4j.XmlUtils.transform(XmlUtils.java:992)
at org.docx4j.XmlUtils.transform(XmlUtils.java:883)
at org.docx4j.model.fields.FieldsPreprocessor.complexifyFields(FieldsPreprocessor.java:94)
at org.docx4j.model.fields.merge.MailMerger.performMerge(MailMerger.java:385)
at com.test.word.FieldsMailMerge.main(FieldsMailMerge.java:84)