phpWord罗马数字的页码

时间:2018-10-02 04:14:04

标签: php phpword

我正在使用以下phpword库:https://github.com/PHPOffice/PHPWord

我对页码中的罗马数字有麻烦,phpword是否可以用罗马数字而不是标准数字显示页码?

我在库中找到以下代码行:

protected $fieldsArray = array(
        'PAGE' => array(
           'properties' => array(
               'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'),
           ),
           'options' => array('PreserveFormat'),
        ),
...
);

只是想知道我怎么能得到它。

1 个答案:

答案 0 :(得分:1)

您可以按以下步骤实现

$phpWord = new PhpWord();
$section = $phpWord->addSection();
$footer = $section->addFooter();
$textRun = $footer->addTextRun(array('alignment' => Jc::CENTER));
$textRun->addField('PAGE', array('format' => 'ROMAN'));
$textRun->addText(' of ');
$textRun->addField('NUMPAGES', array('format' => 'ROMAN'));
相关问题