: This article describes how to convert phpword to html. For more information about PHP tutorials, see. To solve this problem perfectly, we 'd better use windows office software to convert office to pdf or html. libreoffice cannot be converted perfectly, and wps has no APIs.
Check whether the com MODULE is enabled. if there is a com_dotnet module in phpinfo, it indicates that it is enabled. if not, modify php. ini,
Com. allow_dcom = true
The comment above is removed, and the restart will be OK. the Official php website said that the com MODULE was built in before php5.4.5, but not necessarily all. the official website's php 5.3.39, the com module is not built in.
If it is not a built-in module, add it to php. ini, provided that the extension is available in your ext folder.
Extension = php_com_dotnet.dll
Then restart the instance.
Function word2html ($ wordname, $ htmlname)
{
$ Word = new COM ("word. application") or die ("Unable to instancate Word ");
$ Word-> Visible = 1;
$ Word-> Documents-> Open ($ wordname );
$ Word-> Documents [1]-> SaveAs ($ htmlname, 8 );
$ Word-> Quit ();
$ Word = null;
Unset ($ word );
}
Word2html ('d:/www/test/6.docx ', 'd:/www/test/6.html ');
Note:
1. the converted html is messy to view the source code.
2. winword.exe will be used in the conversion process
3. if the page is being loaded, rename the document and re-convert it.
The above introduces php word to html, including the content, hope to be helpful to friends who are interested in PHP tutorials.