PHP Convert Word file to HTML without losing styling and images
52,277
I've spent a bit of time loking into this, and the best solution that I've found was to install unoconv on the server, and using PHP to interface with it through system calls.
I would have loved to find a good native PHP solution for this, but unfortunately I couldn't.
Edit Since originally answering this, I've come across a web service which presents an API for converting documents. I haven't tested it very thoroughly but it does seem to produce decent results at converting Word to HTML: CloudConvert.
Author by
Herr
Updated on July 09, 2022Comments
-
Herr almost 2 years
Is there an API for converting word files to HTML without losing the format?
Can the google documents API be used for this?
I tried saaspose but the returning result is always a server error.
Solutions that did not work for me:
-
alexpls over 10 yearsYou're right - PHPDocx should work for this. Unfortunately you'll need to buy a license in order to get the PHPDocx version that allows DOC/X to HTML.
-
shasi kanth about 10 yearsI guess we need a dedicated hosting for installing Openoffice/unoconv on the server.
-
alexpls about 10 yearsYou would most likely need dedicated hosting, yes.