Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/PhpWord/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
$searchParts[$this->getFooterName($headerIndex)] = &$this->tempDocumentFooters[$headerIndex];
}

// define templates
// result can be verified via "Open XML SDK 2.5 Productivity Tool" (http://www.microsoft.com/en-us/download/details.aspx?id=30425)
$imgTpl = '<w:pict><v:shape type="#_x0000_t75" style="width:{WIDTH};height:{HEIGHT}"><v:imagedata r:id="{RID}" o:title=""/></v:shape></w:pict>';

Expand Down Expand Up @@ -605,7 +604,12 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
$wholeTag = $matches[0];
array_shift($matches);
list($openTag, $prefix, , $postfix, $closeTag) = $matches;
$replaceXml = $openTag . $prefix . $closeTag . $xmlImage . $openTag . $postfix . $closeTag;
if (isset($replacesList[0]['align']) and in_array($replacesList[0]['align'], array('left', 'right', 'center'))) {
$position = '<w:pPr><w:jc w:val="' . $replacesList[0]['align'] . '"/></w:pPr>';
} else {
$position = '';
}
$replaceXml = $openTag . $prefix . $closeTag . $position . $xmlImage . $openTag . $postfix . $closeTag;
// replace on each iteration, because in one tag we can have 2+ inline variables => before proceed next variable we need to change $partContent
$partContent = $this->setValueForPart($wholeTag, $replaceXml, $partContent, $limit);
}
Expand Down