2014-04-04 00:58:42 -03:00
|
|
|
<?php
|
|
|
|
|
include_once 'Sample_Header.php';
|
|
|
|
|
|
2014-08-16 15:21:58 +04:00
|
|
|
// Template processor instance creation
|
|
|
|
|
echo date('H:i:s') , ' Creating new TemplateProcessor instance...' , EOL;
|
|
|
|
|
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_23_TemplateBlock.docx');
|
2014-04-04 00:58:42 -03:00
|
|
|
|
|
|
|
|
// Will clone everything between ${tag} and ${/tag}, the number of times. By default, 1.
|
2014-08-16 15:21:58 +04:00
|
|
|
$templateProcessor->cloneBlock('CLONEME', 3);
|
2014-04-04 00:58:42 -03:00
|
|
|
|
2014-04-05 22:53:39 +07:00
|
|
|
// Everything between ${tag} and ${/tag}, will be deleted/erased.
|
2014-08-16 15:21:58 +04:00
|
|
|
$templateProcessor->deleteBlock('DELETEME');
|
2014-04-05 22:53:39 +07:00
|
|
|
|
2014-08-16 15:21:58 +04:00
|
|
|
echo date('H:i:s'), ' Saving the result document...', EOL;
|
|
|
|
|
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
|
2014-04-04 00:58:42 -03:00
|
|
|
|
2018-12-30 01:13:54 +01:00
|
|
|
echo getEndingNotes(array('Word2007' => 'docx'), 'Sample_23_TemplateBlock');
|
2014-04-16 09:50:56 +07:00
|
|
|
if (!CLI) {
|
|
|
|
|
include_once 'Sample_Footer.php';
|
|
|
|
|
}
|