Cookbook

Integrate phpdocx with Drupal 7

Drupal 7 uses the directory sites/all/libraries for external libraries. The easiest integration of phpdocx is to copy all the library files in the sites/all/libraries/phpdocx and install the libraries module ( https://www.drupal.org/project/libraries).

To run phpdocx, just include the library in any content or file that may execute PHP and work with the available public methods:

Although quite simple to do, this integration is not the most advisable, as it requires to include the library when you need it. It is much better to create a module that lets you work with the library with a precise end.

The packages of the Advanced and Premium licenses come with a specific plugin for Drupal 7. This plugin allows to easily export all Drupal nodes to DOCX, converting the HTML of the nodes content, as well as working as a base to generate other plugins.