diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-05-28 15:01:48 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-05-28 15:01:48 +0000 |
commit | 30bca4da834c69051eb7d85f60c76b9daa3e4dfa (patch) | |
tree | ec85934e7040c350207fba4d522a4d7f1fc95778 | |
parent | 772c938f4cc7e0487ce1c63909313445b86a33b5 (diff) | |
download | poi-30bca4da834c69051eb7d85f60c76b9daa3e4dfa.tar.gz poi-30bca4da834c69051eb7d85f60c76b9daa3e4dfa.zip |
[bug-56155] support version property in CoreProperties
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1901356 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java | 19 | ||||
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/ooxml/TestPOIXMLProperties.java | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java b/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java index 14779374fe..af423bf157 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java +++ b/poi-ooxml/src/main/java/org/apache/poi/ooxml/POIXMLProperties.java @@ -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); } diff --git a/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestPOIXMLProperties.java b/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestPOIXMLProperties.java index fae10b0c0d..4144372623 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestPOIXMLProperties.java +++ b/poi-ooxml/src/test/java/org/apache/poi/ooxml/TestPOIXMLProperties.java @@ -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 |