addComment

addComment

BASIC / ADVANCED / PREMIUM

Inserts a comment into the Word document.

Description
public addComment ( array $options )

This method allows the insertion of a Word comment into the current Word document.

You may fully customize the comment 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 a comment 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 of this array are (required options are shown with yellow background):

key Type Description
textDocument mixed This can be a string of text that will appear in the Word document highlighted or an array with the text and the formatting options (as in the addText method) or a Word fragment.
textComment mixed This is a string of text that will show up in the corresponding footnote or a Word fragment that may include a variety of elements.
initials string The initial that will be shown in the comment balloon.
author string The name of the author of the comments.
date string A date string as the ones used for the strtotime PHP method.
Return values

Void.

Code samples

Example #1

The resulting Word document looks like:

Example #2

The resulting Word document looks like: