且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获得“最后保存者"Java中的Office文件属性

更新时间:2023-09-26 21:09:34

查看Apache POI OOXML 属性提取器 作为此类问题的良好灵感来源,我们知道您需要做的是

Lookin at the Apache POI OOXML Properties Extractor as a good source of inspiration for this sort of problem, we see what you need to do is

OPCPackage pkg = OPCPackage.open(file);
POIXMLProperties props = new POIXMLProperties(pkg);
PackagePropertiesPart ppropsPart = props.getCoreProperties().getUnderlyingProperties();

Date created = ppropsPart.getCreatedProperty().getValue();
Date modified = ppropsPart.getModifiedProperty().getValue();

String lastModifiedBy = ppropsPart.getLastModifiedByProperty().getValue();

这将告诉您上次修改文件的人、创建时间和时间

That'll give you who last modified the file, when, and when it was created