addBookmark

addBookmark

TRIAL / ADVANCED / PREMIUM

Inserts a bookmark into a Word document.

Description
public addBookmark ( array $options )

This method allows to insert bookmarks into a Word document.

This method should be called at least twice within a PHP script: one to open the bookmark tag (type start) and the other one to close it (type end).

One may link the generated bookmark with the addLink method to facilitate the internal navigation through the Word document contents.

Parameters

options

The options array includes the following keys and values (required options are shown with yellow background):

Key Type Description
type string The bookmark type. Possible values are 'start' and 'end'.
name string The name that you want to give to the corresponding bookmark. This is the parameter that should be used within the addLink method to link to the bookmarked content.
Exceptions

Lack of required parameters.

Missing start bookmark.

Incorrect type.

Code samples

Example #1

Example #2

The resulting Word document looks like: