diff --git a/src/PHPWord/Template.php b/src/PHPWord/Template.php index 150676f7..832776c3 100644 --- a/src/PHPWord/Template.php +++ b/src/PHPWord/Template.php @@ -91,7 +91,14 @@ class PHPWord_Template { $this->_documentXML = str_replace($search, $replace, $this->_documentXML); } - + /** + * Returns array of all variables in template + */ + public function getVariables() + { + preg_match_all('/\$\{(.*?)}/i', $this->_documentXML, $matches); + return $matches[1]; + } /** * Save Template *