-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
The following field:
is ignored by org.docx4j.model.fields.FieldUpdater.update(boolean)
An error is logged:
ERROR [main] org.docx4j.model.fields.FieldUpdater.extractInstr(FieldUpdater.java:309) - TODO DOCPROPERTY field contained complex instruction
INFO [main] org.docx4j.model.fields.FieldUpdater.update(FieldUpdater.java:87) -
Simple Fields in /word/document.xml
=============
Found 0 simple fields
Complex Fields in /word/document.xml
==============
Found 1 fields
null
null -> NOT FOUND!
Taking a look at the document itself it seems that the instructions could just be concatenated, e.g. change within org.docx4j.model.fields.FieldUpdater.extractInstr(List<Object>):
String[] instrAsString = instructions.stream()
.map(XmlUtils::unwrap)
.map(o1 -> {
if (o1 instanceof Text) {
return ((Text) o1).getValue();
}
else {
if (log.isErrorEnabled()) {
log.error("TODO: extract field name from " + o1.getClass().getName());
log.error(XmlUtils.marshaltoString(instructions.get(0), true, true));
}
return null;
}
})
.toArray(i -> new String[i]);
if (Arrays.stream(instrAsString).anyMatch(Objects::isNull)) {
return null;
}
return Arrays.stream(instrAsString).collect(Collectors.joining());
Metadata
Metadata
Assignees
Labels
No labels