2016-11-17 17 views
1

我有一些我想要粗體的文本,與前面和後面的段落分開,並且縮進。 我無法讓所有三個屬性一起工作。phpWord中的粗體,間距和縮進文本

這適用於大膽且間隔:

$section = $phpWord->addSection(); 
$section->addText(
    'Re: Your Application for Post of Security Guard', 
    array('bold' => true), 
    array('space' => array('before' => 360, 'after' => 280)) 
); 

,這適用於縮進:

$section = $phpWord->addSection(); 
$section->addText(
    'Re: Your Application for Post of Security Guard', 
    array('indentation' => array('left' => 540, 'right' => 120)) 
    ); 

但這不起作用:

$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)) 
); 

誰能幫助我?

+0

我猜不會有任何phpWord專家那裏今天。 – Benjamin

回答

2

的部分addText功能是:

$section->addText($text, [$fontStyle], [$paragraphStyle]); 

即以正確的方式是你的段落樣式合併到一個數組:

$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) 
    ) 
); 
+0

謝謝,ejuhjav。那很棒! – Benjamin