addEndnote

addEndnote

TRIAL / ADVANCED / PREMIUM

Inserts an endnote into the Word document.

Description
public addEndnote ( array $options )

This method allows the insertion of a endnote into the Word document.

You may fully customize the endnote content including all kind of elements like paragraphs of text with sophisticated formatting, images, links or even tables and HTML content.

If one wishes to insert an endnote within a complex paragraph one should use this method in combination with the addText method.

Parameters

options

An array with the available options.

The possible keys and values are:

key Type Description
textDocument mixed This can be a string of text or a WordFragment that will appear in the Word document just before the endnote call or an array with the text and the formatting options (as in the addText method) or a Word fragment.
textEndnote WordMLFragment This is a string of text that will show up in the corresponding endnote or a WordFragment that may include a variety of elements.
textEndnotes array Add multiple endnotes.
endnoteMark array The keys of this array are:
  • 'customMark': a special character, if any, that you would like to use for the call to the endnote content.
  • 'font': the font family you wish to use (Arial, Calibri...).
  • 'bold': true or false for bold text.
  • 'bidi': true for right to left languages.
  • 'italic': true or false to turn on italics.
  • 'color': an hexadecimal color ('000000', 'FF0000'...).
  • 'rtl': true for right to left languages.
  • 'highlightColor': black, blue, cyan, green, magenta, red, yellow, white, darkBlue, darkCyan, darkGreen, darkMagenta, darkRed, darkYellow, darkGray, lightGray, none.
  • 'underline': underlines text: single.
  • 'backgroundColor': an hexadecimal color.
referenceMark array The keys of this array are:
  • 'font': the font family you wish to use (Arial, Calibri...).
  • 'bold': true or false for bold text.
  • 'bidi': true for right to left languages.
  • 'italic': true or false to turn on italics.
  • 'color': an hexadecimal color ('000000', 'FF0000'...).
  • 'rtl': true for right to left languages.
  • 'highlightColor': black, blue, cyan, green, magenta, red, yellow, white, darkBlue, darkCyan, darkGreen, darkMagenta, darkRed, darkYellow, darkGray, lightGray, none.
  • 'underline': underlines text: single.
  • 'backgroundColor': an hexadecimal color.
pStyle string Paragraph style. Default as endnoteTextPHPDOCX.
rStyle string Character style. Default as endnoteReferencePHPDOCX.
Code samples

Example #1

The resulting Word document looks like:

Example #2

The resulting Word document looks like:

Release notes
  • phpdocx 14.5:
    • internal IDs set using sequential unique values.
  • phpdocx 14.0:
    • highlight, underline and backgroundColor mark options.
  • phpdocx 13.5:
    • WordFragments in textDocument.
    • pStyle and rStyle options.
  • phpdocx 12.5:
    • multiple endnotes in the same content.
  • phpdocx 12.0:
    • htmlspecialchars applied in textEndnote option.