2017-01-20 23 views
1

我想沒有PHPWord邊界創建一個文本框,但設置borderColorborderSize0null有沒有效果,我總是得到至少圍繞文本框黑色邊框邊框創建文本框。沒有PHPWord

$phpWord = new \PhpOffice\PhpWord\PhpWord(); 
$textbox = $section->addTextBox(
    array(
     'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END, 
     'width'  => 200, 
     'height'  => 40, 
     'borderColor' => null, 
     'borderSize' => 0, 
    ) 
); 
$textbox->addText('dummy-text ...', null, array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END)); 
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord); 
$objWriter->save('dummy.docx'); 

回答

0

要創建無邊界borderbox你可以使用(git issue: no outline textbox):

'borderSize' => 'none' 

測試,與PhpWord 0.13.0工作&與MSWORD(LibreOffice中打開生成的文件似乎並沒有認識到這個設置)

+0

嗯,我發現之前,我問,但它不適用於我不幸。如果我使用代碼'$ section-> addTextBox(array('alignment'=> \ PhpOffice \ PhpWord \ SimpleType \ Jc :: START,'width'=> 260,'height'=> 120,'borderSize'=>' none'));'我最終得到[這個結果](https://i.stack.imgur.com/koHR6.png)在Word for Mac Version 15.30 –

+0

這對我也不起作用,如果我使用'' borderColor'=>'none''如鏈接中建議的 –

+0

作爲臨時解決方案,我已將borderColor設置爲與文檔的背景顏色相同,例如''borderColor'=>'white'' – Yoga