I have some text that I want bold, separated from previous and subsequent paragraphs, and indented. I can't get all three properties to work together.
This works for bold and spaced:
$section = $phpWord->addSection();
$section->addText(
'Re: Your Application for Post of Security Guard',
array('bold' => true),
array('space' => array('before' => 360, 'after' => 280))
);
and this works for indented:
$section = $phpWord->addSection();
$section->addText(
'Re: Your Application for Post of Security Guard',
array('indentation' => array('left' => 540, 'right' => 120))
);
but this doesn't work:
$section = $phpWord->addSection();
$section->addText(
'Re: Your Application for Post of Security Guard',
array('bold' => true),
array('space' => array('before' => 360, 'after' => 280)),
array('indentation' => array('left' => 540, 'right' => 120))
);
Can anyone help me?
The section addText function is:
$section->addText($text, [$fontStyle], [$paragraphStyle]);
ie the right way is to combine your paragraph styles into one array:
$section = $phpWord->addSection();
$section->addText(
'Re: Your Application for Post of Security Guard',
array('bold' => true),
array(
'space' => array('before' => 360, 'after' => 280),
'indentation' => array('left' => 540, 'right' => 120)
)
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.