【问题标题】:How to remove custom properties in docx4j如何删除 docx4j 中的自定义属性
【发布时间】:2012-10-30 16:30:55
【问题描述】:

可以像这样在 docx4j 中添加自定义属性:

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

但是如何删除已经设置的属性?

【问题讨论】:

    标签: java docx4j custom-properties


    【解决方案1】:

    getProperty() 返回列表。

    根据 JavaDoc,此访问器方法返回对活动列表的引用,而不是快照。因此,您对返回列表所做的任何修改都将出现在 JAXB 对象中。

    这种方法在 docx4j 中很常见。

    所以您可以从列表中删除 Property 对象。

    【讨论】:

      猜你喜欢
      • 2020-01-07
      • 2017-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-05
      相关资源
      最近更新 更多