Pregunta

It is possible to add custom properties in docx4j like this:

final DocPropsCustomPart customPart = getDocPropsCustomPart();
final Properties customProperties = customPart.getJaxbElement();
...
customProperties.getProperty().add(newProperty);

But how can I remove a property that is already set?

¿Fue útil?

Solución

getProperty() returns List.

As per the JavaDoc, this accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object.

That approach is common across docx4j.

So you can just remove the Property object from the list.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top