如何获得价值[下划线:PhpOffice \ PhpWord \ Style \ Font:private]表单输出PHP_WORD?

问题描述 投票:0回答:1

我想从输出PHP_WORD中获取[下划线:PhpOffice \ PhpWord \ Style \ Font:private]的值,我不知道如何,请向我展示如何。谢谢。(对不起我的英语)

[0] => PhpOffice\PhpWord\Element\Text Object
(
    [text:protected] => C
    [fontStyle:protected] => PhpOffice\PhpWord\Style\Font Object
        (
            [aliases:protected] => Array
                (
                    [line-height] => lineHeight
                    [letter-spacing] => spacing
                )

            [type:PhpOffice\PhpWord\Style\Font:private] => text
            [name:PhpOffice\PhpWord\Style\Font:private] => Tahoma
            [hint:PhpOffice\PhpWord\Style\Font:private] => 
            [size:PhpOffice\PhpWord\Style\Font:private] => 12
            [color:PhpOffice\PhpWord\Style\Font:private] => 
            [bold:PhpOffice\PhpWord\Style\Font:private] => 
            [italic:PhpOffice\PhpWord\Style\Font:private] => 
            [underline:PhpOffice\PhpWord\Style\Font:private] => single
            [superScript:PhpOffice\PhpWord\Style\Font:private] => 
            [subScript:PhpOffice\PhpWord\Style\Font:private] => 
            [strikethrough:PhpOffice\PhpWord\Style\Font:private] => 
            [doubleStrikethrough:PhpOffice\PhpWord\Style\Font:private] => 
            [smallCaps:PhpOffice\PhpWord\Style\Font:private] => 
            [allCaps:PhpOffice\PhpWord\Style\Font:private] => 
            [fgColor:PhpOffice\PhpWord\Style\Font:private] => 
            [scale:PhpOffice\PhpWord\Style\Font:private] => 
            [spacing:PhpOffice\PhpWord\Style\Font:private] => 
            [kerning:PhpOffice\PhpWord\Style\Font:private] => 
            [paragraph:PhpOffice\PhpWord\Style\Font:private] => PhpOffice\PhpWord\Style\Paragraph Object

此处完整数据:https://pastebin.com/raw/prfejCAup

php docx doc phpword
1个回答
0
投票

[\PhpOffice\PhpWord\Element\Text具有访问底层字体样式的方法\PhpOffice\PhpWord\Element\Text

参考getFontStyle(),方法\PhpOffice\PhpWord\Style\Font将返回您要获取的下划线样式的值。

因此,要获得想要的东西,请尝试:

\PhpOffice\PhpWord\Style\Font
© www.soinside.com 2019 - 2024. All rights reserved.