Reputation: 112
I'm using this phpword library: https://github.com/PHPOffice/PHPWord
And I have a trouble about roman numeral in page number, Is it possible for phpword to show page number in roman numeral instead of standard numeral?
i found this line of code in the library:
protected $fieldsArray = array(
'PAGE' => array(
'properties' => array(
'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'),
),
'options' => array('PreserveFormat'),
),
...
);
just wonder how i can get it.
Upvotes: 0
Views: 1898
Reputation: 173
You can achieve this as follows
$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'));
Upvotes: 2