[bug-56155] support version property in CoreProperties

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901356 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-05-28 15:01:48 +00:00
parent 772c938f4c
commit 30bca4da83
2 changed files with 22 additions and 0 deletions

View File

@ -345,6 +345,25 @@ public class POIXMLProperties {
public String getTitle() {
return part.getTitleProperty().orElse(null);
}
/**
* Sets the version property.
* @param version property value
* @since POI 5.2.3
*/
public void setVersion(String version) {
part.setVersionProperty(version);
}
/**
* Returns the version property value.
* @return version property (can be null)
* @since POI 5.2.3
*/
public String getVersion() {
return part.getVersionProperty().orElse(null);
}
public String getRevision() {
return part.getRevisionProperty().orElse(null);
}

View File

@ -219,6 +219,9 @@ public final class TestPOIXMLProperties {
assertEquals("Greetings", subject);
String title = _coreProperties.getTitle();
assertEquals("Hello World", title);
assertNull(_coreProperties.getVersion());
_coreProperties.setVersion("1.2.3");
assertEquals("1.2.3", _coreProperties.getVersion());
}
@Test