From 1ea39dd439945f48defc34a359107c7e0aeb942a Mon Sep 17 00:00:00 2001 From: devX2712 <69680982+devX2712@users.noreply.github.com> Date: Fri, 14 Aug 2020 17:10:01 +0200 Subject: [PATCH] Add read/write Revision document attribut Add read/write Revision document attribut. Informations are stored into document properties. Available for Powerpoint 2007 (reading/writing) --- src/PhpPresentation/DocumentProperties.php | 34 ++++++++++++++++++- src/PhpPresentation/Reader/PowerPoint2007.php | 1 + .../Writer/PowerPoint2007/DocPropsCore.php | 3 ++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/PhpPresentation/DocumentProperties.php b/src/PhpPresentation/DocumentProperties.php index c9344fed2..214fb12f0 100644 --- a/src/PhpPresentation/DocumentProperties.php +++ b/src/PhpPresentation/DocumentProperties.php @@ -91,7 +91,14 @@ class DocumentProperties * @var string */ private $company; - + + /** + * revision + * + * @var string + */ + private $revision; + /** * Create a new \PhpOffice\PhpPresentation\DocumentProperties */ @@ -108,6 +115,7 @@ public function __construct() $this->keywords = ''; $this->category = ''; $this->company = 'Microsoft Corporation'; + $this->revision = ''; } /** @@ -345,4 +353,28 @@ public function setCompany($pValue = '') return $this; } + + /** + * Get Revision + * + * @return string + */ + public function getRevision() + { + return $this->revision; + } + + /** + * Set Revision + * + * @param string $pValue + * @return \PhpOffice\PhpPresentation\DocumentProperties + */ + public function setRevision($pValue = '') + { + $this->revision = $pValue; + + return $this; + } + } diff --git a/src/PhpPresentation/Reader/PowerPoint2007.php b/src/PhpPresentation/Reader/PowerPoint2007.php index aa3b847ac..7b9ff3bc6 100644 --- a/src/PhpPresentation/Reader/PowerPoint2007.php +++ b/src/PhpPresentation/Reader/PowerPoint2007.php @@ -211,6 +211,7 @@ protected function loadDocumentProperties($sPart) '/cp:coreProperties/cp:category' => 'setCategory', '/cp:coreProperties/dcterms:created' => 'setCreated', '/cp:coreProperties/dcterms:modified' => 'setModified', + '/cp:coreProperties/cp:revision' => 'setRevision', ); $oProperties = $this->oPhpPresentation->getDocumentProperties(); foreach ($arrayProperties as $path => $property) { diff --git a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php index 591f42be1..c45d3442d 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php @@ -56,6 +56,9 @@ public function render() // cp:keywords $objWriter->writeElement('cp:keywords', $this->oPresentation->getDocumentProperties()->getKeywords()); + // cp:revision + $objWriter->writeElement('cp:revision', $this->oPresentation->getDocumentProperties()->getRevision()); + // cp:category $objWriter->writeElement('cp:category', $this->oPresentation->getDocumentProperties()->getCategory());