How to Convert a Docx Document to HTML Using PHP

how to get html code from pdf,docx,doc using php

I had a similar problem and i found a github that i used with word docs. It worked fairly good then but i havent tested it of late. try it.

https://github.com/benbalter/Convert-Word-Documents-to-HTML

docx to html with phpword issue

There's a little bit of a problem when it comes to using IOFactory::load of PHPWord such as what you encountered now, depending what saved the file or what version of Microsoft Word is used to create that file. If the encoding and tags of the docx file cannot be found by PHPWord , then it will produce unexpected results

The code is fine, the problem is already with the dependency.

PHP Convert Word file to HTML without losing styling and images

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.

How to convert .docx file into .doc file with PHP?

If you want to get the text out of .docx file and save it as a text file then you can use the library docx2text

after converting it to text file you can read the text file line by line and keep each line data in an array.



Related Topics



Leave a reply



Submit