使特定的词或一串词在phppresentation中加粗
如何使用phppresentation将段落中的特定单词或行加粗使特定的词或一串词在phppresentation中加粗,php,phppresentation,Php,Phppresentation,如何使用phppresentation将段落中的特定单词或行加粗 $textRun = $shape->createTextRun('Your content is centered around promotion of events. While we encourage continuing this practice based on the strong results.'); $textRun->getFont()->setSize(13);
$textRun = $shape->createTextRun('Your content is centered around promotion of events. While we encourage continuing this practice based on the strong results.');
$textRun->getFont()->setSize(13);
$textRun->getFont()->setColor($colorBlack);
$textRun->getFont()->setName('Montserrat');
在上面的文本中,我想将“推广活动”改为粗体和其他文本。我如何在phppresentation库中做到这一点
提前感谢。您必须将文本分成多个部分 您可以使用以下代码:
$oFont = new Font();
$oFont->setSize(13);
$oFont->setColor($colorBlack);
$oFont->setName('Montserrat');
$oFontBold = clone $oFont;
$oFontBold->setBold(true);
$textRun = $shape->createTextRun('Your content is centered around ');
$textRun->setFont($oFont);
$textRun = $shape->createTextRun('promotion of events');
$textRun->setFont($oFontBold);
$textRun = $shape->createTextRun('. While we encourage continuing this practice based on the strong results.');
$textRun->setFont($oFont);
谢谢@Progi你能看一下我添加的问题吗