下面一段代码给大家介绍php将html转入word中,具体内容如下所示:
这是经过测试的,这种方法有一点不好,html页面代码要写在php中,不过好歹能运行,看程序
<?php class word{function start(){ob_start();echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:w="urn:schemas-microsoft-com:office:word"xmlns="http://("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');注意:
1. 转换出来的html,查看源码,比较乱的
2. 转换过程中会调用winword.exe
3. 如果页面一直在加载,把文档重命名,然后在重新转。