Как я могу заменить значения верхнего / нижнего колонтитула с templateProcessor на PhpWord? - PullRequest
0 голосов
/ 04 ноября 2019

У меня есть шаблон docx, и я хочу изменить значения верхних и нижних колонтитулов, используя templateProccessor. Я сделал это с помощью простого текста, но я не знаю, как это сделать для верхних и нижних колонтитулов.

Вот мой код:

    // Creating the new document...
    $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('../Template.docx');

    //Set headers and footers


    //set value
    $templateProcessor->setValue('title', 'Test');

    //Triplicate block
    $templateProcessor->cloneBlock('firstblock', 3, true, true);
    $templateProcessor->setValue('firstname#1', 'John');
    $templateProcessor->setValue('lastname#1', 'Doe');
    $templateProcessor->setValue('firstname#2', 'John');
    $templateProcessor->setValue('lastname#2', 'Doe');
    $templateProcessor->setValue('firstname#3', 'John');
    $templateProcessor->setValue('lastname#3', 'Doe');
    //Set image
    $templateProcessor->setImageValue('logo', array('path' => '../img/logo.png',
        'width' => 100, 'height' => 100));
    $templateProcessor->saveAs('test.docx');
...