Handle the cases were there's no whitespace after <w:tr.

This commit is contained in:
Jeroen Moors 2014-01-27 10:21:43 +01:00
parent 590f08c42b
commit 57f330c099

View File

@ -128,7 +128,15 @@ class PHPWord_Template
* @param mixed $offset * @param mixed $offset
*/ */
private function _findRowStart($offset) { private function _findRowStart($offset) {
return strrpos($this->_documentXML, "<w:tr ", ((strlen($this->_documentXML) - $offset) * -1)); $rowStart = strrpos($this->_documentXML, "<w:tr ", ((strlen($this->_documentXML) - $offset) * -1));
if (!$rowStart) {
$rowStart = strrpos($this->_documentXML, "<w:tr>", ((strlen($this->_documentXML) - $offset) * -1));
}
if (!$rowStart) {
trigger_error("Can not find the start position of the row to clone.");
return false;
}
return $rowStart;
} }
/** /**
@ -137,7 +145,8 @@ class PHPWord_Template
* @param mixed $offset * @param mixed $offset
*/ */
private function _findRowEnd($offset) { private function _findRowEnd($offset) {
return strpos($this->_documentXML, "</w:tr>", $offset) + 7; $rowEnd = strpos($this->_documentXML, "</w:tr>", $offset) + 7;
return $rowEnd;
} }
/** /**