PHPWord 0.11.0 字体样式下划线

1 php codeigniter phpword codeigniter-3 phpoffice

我对 PHPWord 有一个问题,我相信版本是 0.11.0,我使用 PHPWord for CI。

问题是我找不到合适的 php 脚本来制作下划线,这是我得到的最新脚本,

$section->addText(
    $text, 
    [ 'underline' => \PhpOffice\PhpWord\Style\AbstractStyle::UNDERLINE_SINGLE ], // Problem with this line
    [ 'align' => \PhpOffice\PhpWord\Style\Alignment::ALIGN_CENTER ] // This one fine
);
Run Code Online (Sandbox Code Playgroud)

但是每当我得到脚本时,它总是显示错误或没有给我想要的东西,(带下划线的文本)。

这是我得到的错误

遇到未捕获的异常

类型:错误

消息:未定义的类常量“UNDERLINE_SINGLE”

文件名:C:\xampp\htdocs\test\application\controllers\Print.php

行号:47

回溯:

文件:C:\xampp\htdocs\test\index.php 行:315 功能:require_once

我感谢任何帮助,提前致谢。

mah*_*bad 5

要实现单个下划线,请array('underline' => 'single')在样式数组中添加一个元素: