Создание определенных слов или набора слов, выделенных жирным шрифтом в phppresentation - PullRequest
0 голосов
/ 01 ноября 2018

Как сделать отдельные слова или строки жирными в абзаце с помощью 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->getFont()->setColor($colorBlack);
      $textRun->getFont()->setName('Montserrat');

В вышеприведенном тексте я хочу сделать «продвижение событий» жирным шрифтом и другим текстом как есть. Как я могу это сделать в библиотеке phppresentation.

Заранее спасибо.

1 Ответ

0 голосов
/ 06 ноября 2018

Вы должны разделить текст на несколько частей.

Вы можете использовать этот код:

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