Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPword fails to set value for template variable #1761

Closed
Kamala2017 opened this issue Nov 27, 2019 · 0 comments
Closed

PHPword fails to set value for template variable #1761

Kamala2017 opened this issue Nov 27, 2019 · 0 comments

Comments

@Kamala2017
Copy link

I am using template to export document , for one of the downloaded file the content is same as the template variables and blocks .It fails to set the values for that particular section. However there not any specific difference in text , i have also enabled special character escape.

My Template

Education
${educations}
• ${eduyear}, ${edumajor}, ${eduinstitute}.
${/educations}

Certification and Training
${certificates}
• ${ceryear}, ${cermajor}, ${cerinstitute}.
${/certificates}

Exported Document

Education
${educations}
• ${eduyear}, ${edumajor}, ${eduinstitute}.
${/educations}

Certification and Training
${certificates}
• ${ceryear}, ${cermajor}, ${cerinstitute}.
${/certificates}

Code for above section

$edulist = array();
foreach ($empEducationList as $key => $value) {
$eduService = new EducationService();
$eduDetails = $eduService->getEducationById($value->getEducationId());
$level = $eduDetails->getName();
$fromYear = ($value->getStartDate() != null and $value->getStartDate() != '')?date('Y',strtotime($value->getStartDate())):'';
$toYear = ($value->getEndDate() != null and $value->getEndDate() != '')?date('Y',strtotime($value->getEndDate())):'';

        $eduYear            = ($toYear > $fromYear)?$fromYear.'-'.$toYear: $toYear;
        $edulist[]          = array(
                                        'eduyear'               => $eduYear, 
                                        'edumajor'              => $level.' in '.$value->getMajor(),
                                        'eduinstitute'          => $value->getInstitute()
                                    );
    } 
    $templateProcessor->cloneBlock('educations', 0, true, false, $edulist);

Environment

  • PHP Version: 5.7
  • PHPWord Version: 0.17.0
@Kamala2017 Kamala2017 changed the title cloneBlock fails to set value for template variable PHPword fails to set value for template variable Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant