Forum


Replies: 1   Views: 1257
Footnote text style
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 admin  · 10-03-2021 - 11:09

Hello,

By default, phpdocx adds footnoteTextPHPDOCX as paragraph style to footnote contents. If you want to override it, you need to set a custom paragraph style creating a WordFragment:

$wordFragmentFootnote = new WordFragment($docx, 'footnote');
$wordFragmentFootnote->addText('Footnote content', array('pStyle' => 'custom_paragraph_style'));

$footnote->addFootnote(
    array(
        'textDocument' => 'footnote',
        'textFootnote' => $wordFragmentFootnote,
        'footnoteMark' => array('customMark' => '*')
    )
);

There's no option to get if there's a footnote style in a DOCX template and apply it to new footnotes automatically (many DOCX don't have a speficic style for footnotes). It must be applied using the pStyle option, although it could be queried using methods such as getWordStyles.

Regards.