|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | /**
|
3 | 4 | * This file is part of PHPWord - A pure PHP library for reading and writing
|
4 | 5 | * word processing documents.
|
@@ -620,8 +621,8 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
|
620 | 621 |
|
621 | 622 | // collect document parts
|
622 | 623 | $searchParts = array(
|
623 |
| - $this->getMainPartName() => &$this->tempDocumentMainPart, |
624 |
| - ); |
| 624 | + $this->getMainPartName() => &$this->tempDocumentMainPart, |
| 625 | + ); |
625 | 626 | foreach (array_keys($this->tempDocumentHeaders) as $headerIndex) {
|
626 | 627 | $searchParts[$this->getHeaderName($headerIndex)] = &$this->tempDocumentHeaders[$headerIndex];
|
627 | 628 | }
|
@@ -748,7 +749,8 @@ public function cloneRow($search, $numberOfClones)
|
748 | 749 | // If tmpXmlRow doesn't contain continue, this row is no longer part of the spanned row.
|
749 | 750 | $tmpXmlRow = $this->getSlice($extraRowStart, $extraRowEnd);
|
750 | 751 | if (!preg_match('#<w:vMerge/>#', $tmpXmlRow) &&
|
751 |
| - !preg_match('#<w:vMerge w:val="continue"\s*/>#', $tmpXmlRow)) { |
| 752 | + !preg_match('#<w:vMerge w:val="continue"\s*/>#', $tmpXmlRow) |
| 753 | + ) { |
752 | 754 | break;
|
753 | 755 | }
|
754 | 756 | // This row was a spanned row, update $rowEnd and search for the next row.
|
@@ -1067,7 +1069,12 @@ protected function getRelationsName($documentPartName)
|
1067 | 1069 | protected function getNextRelationsIndex($documentPartName)
|
1068 | 1070 | {
|
1069 | 1071 | if (isset($this->tempDocumentRelations[$documentPartName])) {
|
1070 |
| - return substr_count($this->tempDocumentRelations[$documentPartName], '<Relationship'); |
| 1072 | + $candidate = substr_count($this->tempDocumentRelations[$documentPartName], '<Relationship'); |
| 1073 | + while (strpos($this->tempDocumentRelations[$documentPartName], 'Id="rId' . $candidate . '"') !== false) { |
| 1074 | + $candidate++; |
| 1075 | + } |
| 1076 | + |
| 1077 | + return $candidate; |
1071 | 1078 | }
|
1072 | 1079 |
|
1073 | 1080 | return 1;
|
|
0 commit comments