The example in this article describes how PHP implements word-turn HTML. Share to everyone for your reference, specific as follows:
For the perfect solution, office to convert PDF or HTML, preferably with Windows Office software, LibreOffice not perfect conversion, WPS has no API.
First confirm that the COM module is not open, phpinfo inside if there is a com_dotnet module, the description has been opened, if not, modify the php.ini,
Copy Code code as follows:
The previous comments removed, restart on OK, PHP official website said, php5.4.5 before the COM module is built, in fact, is not necessarily all, the official website of the PHP 5.3.39,com module is not built.
If not the built-in module, PHP.ini Plus, the premise of your Ext folder, there is the extension
Copy Code code as follows:
Extension=php_com_dotnet.dll
And then reboot, OK.
function word2html ($wordname, $htmlname)
{
$word = new COM ("Word.Application") or Die ("Unable to instanciate 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 ');
Attention:
1. Convert the HTML, view the source code, the more chaotic
2. Winword.exe will be invoked during the conversion process
3. If the page has been loaded, rename the document and then turn it back on.
For more information about PHP operations Word-related content readers can view this site: "PHP Operations Office Document Skills Summary (including word,excel,access,ppt)"
I hope this article will help you with the PHP program design.