Open Source PHP API for Word Files Processing 

Open, Read, Write, Manipulate & Convert MS Word DOCX files to PDF & HTML format via Free PHP API. Add & edit tables & extract text with ease.

PHPDocx is an open source library that gives software developers the capability to dynamically generate Microsoft Office Word documents inside their own PHP applications. The library is very stable and provides several options for generating word DOCX documents. You can easily create word documents using basic functionality or HTML and CSS conversion to WordML. PHPDocx is available under the LGPL license which is the free version. The paid version is also available with several advanced and customized features such as nested lists, text boxes, customized headers and footers, 3D graphs, MathML, and many more.

The PHPdocX library has included support for some very important features related to word processing and Word document management such as adding texts, inserting and managing tables, adding images and graphic charts to word documents, basic formatting, Word to HTML conversion, and many more. You can also easily import HTML and CSS content as well as export it to a PDF file and many other important features.

Previous Next

Getting Started with PHPDocx

Please download the ZIP package from the PHPDocx page and copy the files to the server path where you will use the data/software library. To start using the software library, it is required to add the license code and subdomain/domain/IP. 

Generate and Edit Word Documents using PHP APIs

The open source PHPDocx library provides the functionality for creating new Word Documents in .docx file formats. The library also provided support for modifying the existing Word Documents according to their own needs. You can easily add text or insert paragraphs, perform Text alignments, add font styles, insert and modify tables, and much more.

Text Extraction from Word DOCX

The open source PHPDocx library gives software developers the capability to extract text from Word DOCX file format inside their application with just a couple of lines of PHP code. It also included support for extracting images, headings, table data, and much more from a Word document with ease. You can also easily add text to a place of your choice inside a Word document. The library also supports transforming your text to Word documents with ease.

Add & Edit Tables inside Word DOCX

Tables are a very useful part of Microsoft Word documents and are mainly used for organizing content in different ways. The open source PHPDocx API has included complete support for adding and modifying tables inside their PHP applications. You can also perform different operations on your tables such as inserting a new row to tables, adding cells to the table, inserting text to a cell, adding the nested table, merging cells, adding a border of your choice to a table, and so on.

Add Table inside Word DOCX - PHP

require_once '../../../classes/CreateDocx.php';
$docx = new CreateDocx();
// create a few Word fragments to insert rich content in a table
$link = new WordFragment($docx);
$options = array(
  'url' => ''

$link->addLink('Link to Google', $options);

$image = new WordFragment($docx);
$options = array(
  'src' => '../../img/image.png'


$valuesTable = array(
    'Title A',
    'Title B',
    'Title C'
    'Line A',

$paramsTable = array(
  'tableStyle' => 'LightListAccent1PHPDOCX',
  'tableAlign' => 'center',
  'columnWidths' => array(1000, 2500, 3000),

$docx->addTable($valuesTable, $paramsTable);


Word Documents to PDF using PHP

PDF (Portable Document Format) is a universally popular file format and is used for storing many types of data. The free version of PHPDocx library has included functionality for transforming Microsoft Word documents to PDF file formats with ease.