猿问

文本加粗且不符合 php 单词

我是初学者 php 开发人员。我在 Laravel 和https://github.com/PHPOffice/PHPWord中有项目。


做工很好啊 我有一个小问题。


这是我的代码:


$phpWord = new \PhpOffice\PhpWord\PhpWord();

        $section = $phpWord->addSection(

            array('orientation' => 'landscape', 'marginLeft' => 800, 'marginRight' => 800,'marginTop' => 700, 'marginBottom' => 700)

        );


        $footerFont = array('size' => 6, 'bold' => false, 'color'=>'black');

        $footer = $section->addFooter();

        $footer->addPreserveText(' Strona {PAGE} z {NUMPAGES} - Symfonia Smaków. Wszystkie prawa zastrzeżone. Data wydruku: '.date("Y-m-d H:i:s"), $footerFont);


        $header = $section->addHeader();

        $header->addImage($logo, array('width'=>50, 'height'=>40, 'align'=>'right'));


        $section->addTextBreak(4);

$summaryFont = array('size' => 8, 'bold' => true);

$section->addText("* alergeny zostały oznaczone wytłuszczoną czcionką.", $summaryFont, array('align' => 'left'));

在文本中:* 过敏原以粗体标记。- 我需要添加粗体:


* alergeny zostały oznaczone <b>wytłuszczoną</b> czcionką.


我怎样才能做到呢?


杨__羊羊
浏览 89回答 1
1回答

qq_花开花谢_0

在 README.md 第一页添加使用显式创建的字体样式对象自定义字体的文本元素...$fontStyle = new \PhpOffice\PhpWord\Style\Font();$fontStyle->setBold(true);$fontStyle->setName('Tahoma');$fontStyle->setSize(13);$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');$myTextElement->setFontStyle($fontStyle);添加使用命名字体样式自定义字体的文本元素...$fontStyleName = 'oneUserDefinedStyle';$phpWord->addFontStyle(&nbsp; &nbsp; $fontStyleName,&nbsp; &nbsp; array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true));$section->addText(&nbsp; &nbsp; '"The greatest accomplishment is not in never falling, '&nbsp; &nbsp; &nbsp; &nbsp; . 'but in rising again after you fall." '&nbsp; &nbsp; &nbsp; &nbsp; . '(Vince Lombardi)',&nbsp; &nbsp; $fontStyleName);
随时随地看视频慕课网APP
我要回答