1
我可以在section
中使用textrun
替換文檔正文中的純文本和粗體文本。phpWord footer中的替代粗體和常規文本
$textrun->addText(' Short address here ');
$textrun->addText(' T ', $boldFontStyleName);
$textrun->addText(' ++353 1 5552999. ');
但我不能在我需要它的地方,在FOOTER中獲得相同的效果。文本與$footer->addText
一起添加,不允許內聯添加新文本。
我試過了解我所知道的一切,包括連接並將$textrun->addText
輸出分配給一個新的$variable
,我只通過$footer->addText($variable)
向頁腳添加一次;沒有運氣。
我現在的代碼如下,如果有人可以調整它的工作,我會很感激。或者,它只是在phpWord的頁腳不支持這種格式的水平?
// footer
$footer = $section->addFooter();
// define bold style
$boldFontStyleName = 'BoldText';
$phpWord->addFontStyle($boldFontStyleName, array('bold' => true));
// add text
$footer->addText(' Short address here ');
$footer->addText(' T ', $boldFontStyleName);
$footer->addText(' ++353 1 5552999. ');
謝謝!我以爲我曾嘗試過,但我必須留下一些東西。這是你救了我兩次! – Benjamin