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

How to change font size when using TemplateProcessor? #2288

Open
ngekoding opened this issue Sep 6, 2022 · 0 comments
Open

How to change font size when using TemplateProcessor? #2288

ngekoding opened this issue Sep 6, 2022 · 0 comments

Comments

@ngekoding
Copy link

Is it possible to change font size when using TemplateProcessor?

I was try to do this, but not working.

$template = new PhpOffice\PhpWord\TemplateProcessor('template.docx');
$template->setValues([
  'name' => 'Nur Muhammad',
  'country' => 'Indonesia'
]);
$template->saveAs('result1.docx');

// Try to change the font size
$phpword = PhpOffice\PhpWord\IOFactory::load('result1.docx');
$phpword->setDefaultFontSize(9);
$phpword->save('result2.docx');

The problem I get:

  1. The document styles is lose
  2. The font size not change

Thanks in advance.

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

No branches or pull requests

2 participants