01. Configure Word Export


How to export a Word Document with POI4XPAGES
1. Download POI4Xpages
2. Install the Extension on your Server and Designer Client

Prepare your Word file.


· <<name>>, <<address>>, <<zip>>, <<location>> and <<e-mail>> are place holders. They will be replaced with calculated values

Open the XPage on which the export should be performed.

Add the ‘POI Document’ control to the XPage


Select the POI Document control and switch to the properties panel to configure the export.



The downloadFileName specifies the name of the file which will be created.

The pathInfo can be used if you like to call the export function directly by a URL. By enter the URL xpagename.xsp/pathInfo/contract.docx the export starts automatically.


Add a templateSource. The templateSource defines which Word file is going to be used for the export. You can choose between “resourcetemplate” (a resource file) or “attachmenttemplate” (an attachment in a document from a defined database).

In this example we use ‘resourcetemplate’


· databaseName: The database where the resource file is saved, empty means the current database
· filename: The name of the resource file


Remember the <<name>>, <<address>> etc values in the Word file. We will now set the values for these fields by defining some 'docbookmarks'.


With the definition of the docbookmarks all the <<name>> and <<address>> tags in the Word file will be replaced with the specified values during the export.

Be aware that you have to write ‘name’ instead of ‘<<name>>’ for the docbookmark name.



The configuration is now done. Let us export the word file by button. The button needs an “onClick()” eventhandler like this:

Choose “Generate Document” and select the ID of the POI Document definition.