Skip to content

Conversation

@troosan
Copy link
Contributor

@troosan troosan commented Jan 31, 2019

Description

This Pull Request allows to insert a ComplexType in a Template.

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes

@troosan troosan added this to the v0.17.0 milestone Jan 31, 2019
@coveralls
Copy link

coveralls commented Jan 31, 2019

Coverage Status

Coverage increased (+0.03%) to 94.572% when pulling d2b0b31 on troosan:set_complex_type_in_template into af31fc5 on PHPOffice:develop.

@troosan troosan merged commit 98026ae into PHPOffice:develop Feb 4, 2019
@devhardiyanto
Copy link

someone can approve this function?

@troosan troosan deleted the set_complex_type_in_template branch September 8, 2019 21:01
@troosan
Copy link
Contributor Author

troosan commented Sep 8, 2019

don't worry, it's approved. I only need to release the next version. Will do so soon

@devhardiyanto
Copy link

oke thanks @troosan

@joaodos3v
Copy link

joaodos3v commented Sep 10, 2019

I know it's not an official release yet, but I was testing this functionality and noticed that, unlike setValue, it doesn't change all instances of the macro.

In the test I did, it only changes the first occurrence. Should that be?
I tried something like:

$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($originalFile);
$inline = new TextRun();
$inline->addText("NewValue", array('italic' => true,  'color' => 'red'));
$templateProcessor->setComplexValue("old_value", $inline);
$templateProcessor->saveAs($originalFile);

@troosan
Copy link
Contributor Author

troosan commented Oct 1, 2019

@joao-vieira indeed, you are right. If you have multiple placeholders to replace you'll have to call the replace multiple times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants