Sample 23 TemplateBlock

00:50:37 Creating new TemplateProcessor instance...
00:50:37 Saving the result document...
00:50:37 Done writing file(s)
00:50:37 Peak memory usage: 2 MB

 

Results: docx


<?php

include_once 'Sample_Header.php';

// Template processor instance creation
echo date('H:i:s') , ' Creating new TemplateProcessor instance...' EOL;
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_23_TemplateBlock.docx');

// Will clone everything between ${tag} and ${/tag}, the number of times. By default, 1.
$templateProcessor->cloneBlock('CLONEME'3);

// Everything between ${tag} and ${/tag}, will be deleted/erased.
$templateProcessor->deleteBlock('DELETEME');

echo 
date('H:i:s'), ' Saving the result document...'EOL;
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');

echo 
getEndingNotes(array('Word2007' => 'docx'), 'Sample_23_TemplateBlock');
if (!
CLI) {
    include_once 
'Sample_Footer.php';
}