Integrate phpdocx with WordPress

WordPress doesn't include a specific directory for external libraries. The easiest way to integrate phpdocx is to copy all the library files and paste them in the wp-content/plugins/phpdocx directory. Then, modify the functions.php file by adding these lines to the beginning:

This integration lets you work with phpdocx in any content or file that may execute PHP. E.g.: you can generate a file with HTML and save it in the wp-content/uploads folder:

The uploads directory must exist prior to making these changes, and it must have read and write access for the web server user.

Although quite a simple task to do, this integration is not advisable, as it loads the library in all pages without a real purpose. It is much better to create a plugin to use the library with a precise end.

The packages included in the Advanced and Premium licenses include a specific plugin for Wordpress. This plugin allows to easily export posts from WordPress to DOCX, converting the HTML of the post content as well as working as a base to generate other plugins.