Author: Timothy Edwards
Updated on: 2021-10-14
Posted on: 2021-10-14
Viewers: 7 (October 2021)
Package: PHP Parse DOCX to HTML with Images
Background to this class and info on screenshots and implementation
A while ago I was looking for a means of converting a Word DOCX file to display on a website using PHP. I found the class wordtohtml on this PHP classes website. I downloaded it, but found it very basic for my needs.
As the original author did not appear to still be involved, I forked the original Github repository and have now developed the class to recognise virtually all Word formatting, styles and themes except for tabs which are not really practical in html. I also developed this new class to also recognise multi-level lists with the correct alpha-numeric numbering and tables with merged cells. The resultant html when displayed in a web browser looks very similar to the original DOCX Word document.
There are some screenshots in my github repository showing both the word and htlm web browser screenshots for a sample file. For some reason I am unable to upload these to this PHP Classes page.
As can be seen from the example file 'test.php', using the class in its default mode is very easy once you have downloaded the 'wordphp.php' file and loaded it to an appropriate place on your website.
I have provided a few options on top of the default mode. See the Readme file for details of usage:-
1. Ability to change the output coding of the html
2. Allow external CSS file to format any images in the file
3. Allow tables to take up 100% of the screen width
You need to be a registered user or login to post a comment
Login Immediately with your account on:
No comments were submitted yet.