Forum


Replies: 5   Views: 1844
Roman page number in footer
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by hotspot22  · 10-06-2020 - 12:57

Thanks for the fast reply! It was my fault not checking it in detail before asking :(

License is Premium 9.5.

The shown example in my first post is working perfectly even with sections with different number format types.

I was only checking the first pages having a (unwanted) decimal numbering and not the following pages which are defined with Roman numbering, sorry.

Here is my working example with TOC, page numbering in footer and different page number types:

$docx = new CreateDocx();

// create a Word fragment to insert in the default footer
$numbering = new WordFragment($docx, 'defaultFooter');

// set some formatting options
$options = array(
        'textAlign' => 'right',
        'bold' => true,
        'sz' => 14,
        'color' => 'B70000',
);
$numbering->addPageNumber('numerical', $options);
$docx->addFooter(array('default' => $numbering));

$docx->addText('TOC', array('bold' => true, 'fontSize' => 14));
$legend = array('text' => 'Update TOC',
                'color' => 'B70000',
                'bold' => true,
                'fontSize' => 12);
$docx->addTableContents(array('autoUpdate' => true), $legend);

$docx->addSection('nextPage', 'A4', ['pageNumberType' => ['fmt' => 'upperRoman', 'start' => 2]]);
$docx->addText('Part One', array('pStyle' => 'Heading1PHPDOCX'));
$docx->addText('Lorem ipsum...');
$docx->addText('Heading 1', array('pStyle' => 'Heading2PHPDOCX'));
$docx->addText('Lorem ipsum...');

$docx->addBreak(array('type' => 'page'));
$docx->addText('Heading 2', array('pStyle' => 'Heading2PHPDOCX'));
$docx->addText('Lorem ipsum...');

$docx->addSection('nextPage', 'A4', ['pageNumberType' => ['fmt' => 'decimal', 'start' => 1]]);
$docx->addText('Part Two', array('pStyle' => 'Heading1PHPDOCX'));
$docx->addText('Lorem ipsum...');
$docx->addText('Heading 1', array('pStyle' => 'Heading2PHPDOCX'));

$docx->addBreak(array('type' => 'page'));
$docx->addText('Heading 2', array('pStyle' => 'Heading2PHPDOCX'));
$docx->addText('Lorem ipsum...');

Is it possible to have the TOC items with style Heading1PHPDOCX without a page number in TOC like it's described here: https://support.microsoft.com/en-us/help/319821/how-to-create-table-of-contents-entries-without-a-page-number-in-word ?

And is it possible to remove the page number in footer for specific pages? I want to add a summary page before the TOC and these two pages should have no page number in footer.