diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 649fde40c8..3f7770d3d7 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -1,4 +1,5 @@ getMainPartName() => &$this->tempDocumentMainPart, - ); + $this->getMainPartName() => &$this->tempDocumentMainPart, + ); foreach (array_keys($this->tempDocumentHeaders) as $headerIndex) { $searchParts[$this->getHeaderName($headerIndex)] = &$this->tempDocumentHeaders[$headerIndex]; } @@ -748,7 +749,8 @@ public function cloneRow($search, $numberOfClones) // If tmpXmlRow doesn't contain continue, this row is no longer part of the spanned row. $tmpXmlRow = $this->getSlice($extraRowStart, $extraRowEnd); if (!preg_match('##', $tmpXmlRow) && - !preg_match('##', $tmpXmlRow)) { + !preg_match('##', $tmpXmlRow) + ) { break; } // This row was a spanned row, update $rowEnd and search for the next row. @@ -1067,7 +1069,12 @@ protected function getRelationsName($documentPartName) protected function getNextRelationsIndex($documentPartName) { if (isset($this->tempDocumentRelations[$documentPartName])) { - return substr_count($this->tempDocumentRelations[$documentPartName], 'tempDocumentRelations[$documentPartName], 'tempDocumentRelations[$documentPartName], 'Id="rId' . $candidate . '"') !== false) { + $candidate++; + } + + return $candidate; } return 1;