Merge pull request #2063 from tpv-ebben/develop
when adding image to relationship first check that the generated RID is actually unique
This commit is contained in:
commit
d905e764e3
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
|
|
@ -748,7 +749,8 @@ class TemplateProcessor
|
|||
// If tmpXmlRow doesn't contain continue, this row is no longer part of the spanned row.
|
||||
$tmpXmlRow = $this->getSlice($extraRowStart, $extraRowEnd);
|
||||
if (!preg_match('#<w:vMerge/>#', $tmpXmlRow) &&
|
||||
!preg_match('#<w:vMerge w:val="continue"\s*/>#', $tmpXmlRow)) {
|
||||
!preg_match('#<w:vMerge w:val="continue"\s*/>#', $tmpXmlRow)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
// This row was a spanned row, update $rowEnd and search for the next row.
|
||||
|
|
@ -1067,7 +1069,12 @@ class TemplateProcessor
|
|||
protected function getNextRelationsIndex($documentPartName)
|
||||
{
|
||||
if (isset($this->tempDocumentRelations[$documentPartName])) {
|
||||
return substr_count($this->tempDocumentRelations[$documentPartName], '<Relationship');
|
||||
$candidate = substr_count($this->tempDocumentRelations[$documentPartName], '<Relationship');
|
||||
while (strpos($this->tempDocumentRelations[$documentPartName], 'Id="rId' . $candidate . '"') !== false) {
|
||||
$candidate++;
|
||||
}
|
||||
|
||||
return $candidate;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue