If openoffice template specifies pagerepeat, use it

This commit is contained in:
Nathan Gray 2012-05-08 14:31:02 +00:00
parent 53a899955e
commit b3122d519f

View File

@ -628,6 +628,8 @@ abstract class bo_merge
}
if ($mimetype == 'application/vnd.oasis.opendocument.text' && count($ids) > 1)
{
if(strpos($content, '$$pagerepeat') === false)
{
//for odt files we have to split the content and add a style for page break to the style area
list($contentstart,$contentrepeat,$contentend) = preg_split('/office:body>/',$content,-1, PREG_SPLIT_NO_EMPTY); //get differt parts of document, seperatet by Pagerepeat
@ -639,6 +641,12 @@ abstract class bo_merge
$contentstart .= '<office:body>';
$contentend = '</office:body></office:document-content>';
}
else
{
// Template specifies where to repeat
list($contentstart,$contentrepeat,$contentend) = preg_split('/\$\$pagerepeat\$\$/',$content,-1, PREG_SPLIT_NO_EMPTY); //get different parts of document, seperated by pagerepeat
}
}
if ($mimetype == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' && count($ids) > 1)
{
//for Word 2007 XML files we have to split the content and add a style for page break to the style area
@ -1344,7 +1352,6 @@ abstract class bo_merge
//error_log(__METHOD__."() !this->merge() err=$err");
return $err;
}
// Apply HTML formatting to target document, if possible
// check if we can use the XSL extension, to not give a fatal error and rendering whole merge-print non-functional
if (class_exists(XSLTProcessor) && class_exists(DOMDocument) && $this->parse_html_styles)