Announcement

Collapse
No announcement yet.

template processing docx

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • template processing docx

    Hello Teams,

    i know big deal with 6.0 and too todo list
    is there any possibility to have docx templating ?

    phpWord can give opportuinity to use the templating :

    $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('PS_FR.docx') ; => of course change to a templateId
    $templateProcessor->setValue('patientName', $patient->get('name'));

    templating word is too {{patientName}} .. so no need new language.

    and like pdf at the end :

    $templateProcessor->saveAs('php://output');
    $docxData = ob_get_contents();

    i will search if someone can give me direction

    Best Regards
    Last edited by item; 10-14-2020, 06:48 PM.

  • #2
    For someone need tips about how phpWord :

    PHP Code:
    <?php

    $i
    =1;
    $templateProcessor->cloneRow('userId'count($usersList));
    foreach(
    $usersList as $user){
    $templateProcessor->setValue('userId#'.$i $i);
    $templateProcessor->setValue('userName#'.$i $user->get('name'));
    $templateProcessor->setValue('userEmailAddress#'.$i $user->get('emailAddress'));
    $i++;
    }
    $i=1;
    $templateProcessor->cloneRow('contactId'count($contactList) + count($leadList));
    foreach(
    $contactList as $contact){
    $status $meeting->getLinkMultipleColumn('contacts''status'$contact->id);
    $templateProcessor->setValue('contactId#'.$i $i);
    $templateProcessor->setValue('contactName#'.$i$contact->get('name'));
    $templateProcessor->setValue('contactProfession#'.$i$contact->get('professionName'));
    $templateProcessor->setValue('contactPhoneNumber#'.$i$contact->get('phoneNumber'));
    $templateProcessor->setValue('contactEmailAddress#'.$i$contact->get('emailAddress'));
    $templateProcessor->setValue('status#'.$i$status);

    $i++;
    }
    foreach(
    $leadList as $lead){
    $status $meeting->getLinkMultipleColumn('leads''status'$lead->id);
    $templateProcessor->setValue('contactId#'.$i $i);
    $templateProcessor->setValue('contactName#'.$i$lead->get('name'));
    $templateProcessor->setValue('contactProfession#'.$i$lead->get('fonction'));
    $templateProcessor->setValue('contactPhoneNumber#'.$i$lead->get('phoneNumber'));
    $templateProcessor->setValue('contactEmailAddress#'.$i$lead->get('emailAddress'));
    $templateProcessor->setValue('status#'.$i$status);
    $i++;
    }

    Comment

    Working...
    X