When I use addText()
it works fine with align=center
, left or right, but when I try use align=justify
script works without problems, but when I try to open .docx
file it gives me error and file is not openning.
It would be appreciated if someone knows solution.
$text = "some text";
$PHPWord->addFontStyle('r2Style', array('bold'=>false, 'italic'=>false, 'size'=>12));
$PHPWord->addParagraphStyle('p2Style', array('align'=>'center', 'spaceAfter'=>100));
$section->addText($text, 'r2Style', 'p2Style');
try change 'align'=>'left'
to 'align'=>'both'
$text = "some text";
$PHPWord->addFontStyle('r2Style', array('bold'=>false, 'italic'=>false, 'size'=>12));
$PHPWord->addParagraphStyle('p2Style', array('align'=>'both', 'spaceAfter'=>100));
$section->addText($text, 'r2Style', 'p2Style');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With