<?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_07_TemplateCloneRow.docx'); $block = $templateProcessor->getTemplateStructure(); echo date('H:i:s'), ' Done getting template structure...', EOL; // Variables on different parts of document $templateProcessor->setValue('weekday', htmlspecialchars(date('l'))); // On section/content $templateProcessor->setValue('time', htmlspecialchars(date('H:i'))); // On footer $templateProcessor->setValue('serverName', htmlspecialchars(realpath(__DIR__))); // On header // Simple table $templateProcessor->cloneRow('rowValue', 10); // clone block $templateProcessor->cloneBlock('blockToday', 2); $templateProcessor->deleteBlock('deleteBlock'); $templateProcessor->setValue('rowValue#1', htmlspecialchars('Sun')); $templateProcessor->setValue('rowValue#2', htmlspecialchars('Mercury')); $templateProcessor->setValue('rowValue#3', htmlspecialchars('Venus')); $templateProcessor->setValue('rowValue#4', htmlspecialchars('Earth')); $templateProcessor->setValue('rowValue#5', htmlspecialchars('Mars')); $templateProcessor->setValue('rowValue#6', htmlspecialchars('Jupiter')); $templateProcessor->setValue('rowValue#7', htmlspecialchars('Saturn')); $templateProcessor->setValue('rowValue#8', htmlspecialchars('Uranus')); $templateProcessor->setValue('rowValue#9', htmlspecialchars('Neptun')); $templateProcessor->setValue('rowValue#10', htmlspecialchars('Pluto')); $templateProcessor->setValue('rowNumber#1', htmlspecialchars('1'));