diff --git a/src/Parser.php b/src/Parser.php index 745c7a2..bd5a2ab 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -216,6 +216,16 @@ public function minifyHtml($html) { private function _processSpaces() { $this->_openXml = preg_replace("/( )/mi", " ", $this->_openXml); + $this->_openXml = preg_replace_callback( + '/(.*?)<\/w:t>/s', + function ($matches) { + $text = $matches[1]; + /* Only remove leading and trailing spaces if they are not intentional. */ + $text = preg_replace('/^\s+/', '', $text); // führende entfernen + return "{$text}"; + }, + $this->_openXml + ); $this->_openXml = preg_replace("/()/mi", "", $this->_openXml); $this->_openXml = $this->minifyHtml($this->_openXml); @@ -295,4 +305,4 @@ private function _getStyle($type, $wrap = true) { return sprintf('%2$s', $type, $this->{$field}); } -} \ No newline at end of file +}