Merging Word Documents with PHPDocX
Since the v2.5.3 the PRO+ package incorporates new utilities that, among other things, allow for the full merging of Word documents.
But what do we mean by "full merging"?
The new mergeDocX method preserves, if so chosen:
- The sections of the merged documents including:
- Theirs section properties like paper sizes and margins.
- Their headers and footers with its associated media.
- All styles, including the ones associated with different lists types as well as headings, tables, paragraphs, etcetera.
- Embedded images and links.
- Charts with all their associated data and options.
- Footnotes, endnotes and comments.
One may also choose to preserve the page numbering of the original documents or set the page numbers to run as they would normally do in a Word document.
Although some of this features may seem pretty simple to implement it is not so because of the interrelationships among them and the sophistication of the OOXML standard.
But, of course, the main goal of the mergeDocx method is to encapsulate all that complexity and let the final user to generate a single Word document out of two other ones in just a couple of lines of code:
require_once 'path /classes/DocxUtilities.inc'; $newDocx = new DocxUtilities(); $myOptions = array('mergeType' => 0); $newDocx->mergeDocx('firstWordDoc.docx', 'secondWordDoc.docx', 'mergedWord.docx', $myOptions);
We hope that you will find of interest this new method that allows to merge sophisticated Word documents so easily.
March 4, 2013We are happy to announce the release of PHPDocX v3.2. This new version includes some important changes that greatly improve the PHPDocX...
February 6, 2013Since v3.0 we have included the notion of Word (or WordML) fragments to simplify the process of creating sophisticated Word documents from scratch...
January 31, 2013We are happy to announce the release of PHPDocX v3.1 This new version includes quite a few new features that you may find interesting: It is now...
January 8, 2013We have just released PHPDocX v3.0. This new version includes substantial changes that have required that this new version were not fully backwards...
December 21, 2012Although one can easily introduce real checkboxes in a Word document generated by PHPDocX via the embedHTML method (just include the corresponding...