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

Add addPage() operation in TemplateProcessor #1301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YvesAmmann
Copy link

Added new method addPage() and replace & to & in method setValue().

Description

Create a bulk letter with the same template for each page.

$word = new \PhpOffice\PhpWord\PhpWord();
$document = $word->loadTemplate('Template.docx');

$page = 0;

foreach ($document_page as $document_address) {
	if ($page > 0) {
		$document->addPage();
	}

	$document->setValue('ADDRESS', $document_address);
}

$document->saveAs('Bulkletter.docx');

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 update the documentation to describe the changes

Added new method addPage() and replace & to & in method setValue()
@troosan
Copy link
Contributor

troosan commented Dec 11, 2018

@YvesAmmann instead of replacing & info & you should call

Settings::setOutputEscapingEnabled(true);

If I'm not mistaken this should make sure entities are escaped.

@troosan troosan changed the title Update TemplateProcessor.php Add addPage() operation in TemplateProcessor Dec 11, 2018
@PowerKiKi PowerKiKi changed the base branch from develop to master November 16, 2022 21:11
@Progi1984 Progi1984 force-pushed the master branch 3 times, most recently from 2d9f999 to e458249 Compare August 30, 2023 11:56
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.

None yet

2 participants