PHPWORD:我无法设置属性' paragraphStyle'在textrun

时间:2016-11-21 10:38:13

标签: php phpword

这有效

$text = $textrun->addText($organization['name']);   
$text->setFontStyle($textFontStyleBold);
$text->setParagraphStyle($textParagraphStyle);

但是...

 $textrun = $section->createTextRun();
 $textrun->setParagraphStyle($textParagraphStyle); 

 $text = $textrun->addText($organization['name']);   
 $text->setFontStyle($textFontStyleBold);
 $text->setParagraphStyle($textParagraphStyle);

 $text = $textrun->addText(", bla_bla");
 $text->setFontStyle($textFontStyle);
$text->setParagraphStyle($textParagraphStyle);

// var_dump ($textrun)
// protected 'paragraphStyle' => null

1 个答案:

答案 0 :(得分:0)

$ textrun = $ section-> createTextRun($ textParagraphStyle);