Apache poi 将字段设置为“;最后修改为;在office DOCX文件元数据中-Apache POI 3.9-

Apache poi 将字段设置为“;最后修改为;在office DOCX文件元数据中-Apache POI 3.9-,apache-poi,apache-tika,Apache Poi,Apache Tika,使用POIXMLProperties.getCoreProperties()和POIXMLProperties.getExtendedProperties() 我可以设置所有元数据值​​除了“Last Modified By”之外,还有什么方法可以设置它吗 感谢您的帮助。我正在使用POI 3.10-beta1,它对我有效,也就是说,您可以直接在PackageProperties中进行设置: import java.util.Date; import org.apache.poi.openxml4

使用POIXMLProperties.getCoreProperties()和POIXMLProperties.getExtendedProperties()

我可以设置所有元数据值​​除了“Last Modified By”之外,还有什么方法可以设置它吗


感谢您的帮助。

我正在使用POI 3.10-beta1,它对我有效,也就是说,您可以直接在
PackageProperties
中进行设置:

import java.util.Date;
import org.apache.poi.openxml4j.opc.*;
import org.apache.poi.openxml4j.util.Nullable;

public class LastModifiedBy {
    public static void main(String[] args) throws Exception {
        OPCPackage opc = OPCPackage.open("lastmodifed.docx");
        PackageProperties pp = opc.getPackageProperties();
        Nullable<String> foo = pp.getLastModifiedByProperty();
        System.out.println(foo.hasValue()?foo.getValue():"empty");
        pp.setLastModifiedByProperty("user"+System.currentTimeMillis());
        pp.setModifiedProperty(new Nullable<Date>(new Date()));
        opc.close();
    }
}
import java.util.Date;
导入org.apache.poi.openxml4j.opc.*;
导入org.apache.poi.openxml4j.util.Nullable;
公共类LastModifiedBy{
公共静态void main(字符串[]args)引发异常{
OPCPackage opc=OPCPackage.open(“lastmodifyd.docx”);
PackageProperties pp=opc.getPackageProperties();
可为null的foo=pp.getLastModifiedByProperty();
System.out.println(foo.hasValue()?foo.getValue():“空”);
pp.setLastModifiedByProperty(“用户”+系统.currentTimeMillis());
pp.setModifiedProperty(新的可空(新的日期());
opc.close();
}
}

如果您可以获得
POIXMLProperties.CoreProperties
,您就不能使用
setModified
?如果您使用它,并将其设置为比文件的任何其他修改都要晚,那不是最后一次修改日期吗?我指的不是修改日期,而是最后一次修改文档的人