No Description

Sample_23_TemplateBlock.php 739B

1234567891011121314151617181920
  1. <?php
  2. include_once 'Sample_Header.php';
  3. // Template processor instance creation
  4. echo date('H:i:s') , ' Creating new TemplateProcessor instance...' , EOL;
  5. $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_23_TemplateBlock.docx');
  6. // Will clone everything between ${tag} and ${/tag}, the number of times. By default, 1.
  7. $templateProcessor->cloneBlock('CLONEME', 3);
  8. // Everything between ${tag} and ${/tag}, will be deleted/erased.
  9. $templateProcessor->deleteBlock('DELETEME');
  10. echo date('H:i:s'), ' Saving the result document...', EOL;
  11. $templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
  12. echo getEndingNotes(array('Word2007' => 'docx'));
  13. if (!CLI) {
  14. include_once 'Sample_Footer.php';
  15. }