php com word.application输出到html文件但未知文件

时间:2014-11-18 03:43:41

标签: php html com header-files

这是我的代码:

$word = new COM("word.application");
$word->Visible = 1;
$word->Documents->Open('./../Team.docx');
$filename = tempnam(sys_get_temp_dir(), "");
$word->Documents[1]->SaveAs($filename);
$word->quit();
unset($word);
//header("Content-type: application/vnd.ms-word");
//header("Content-Disposition: attachment;Filename=test.doc");
header('Content-Encoding: UTF-8');
header('Content-type: text/html; charset= UTF-8');
header("Content-Disposition: attachment;Filename=Test.html");
// Send file to browser 
readfile($filename);
unlink($filename);

我的代码想知道将MsWord文件比SaveAs文件读到HTML文件中的新文件但它还不正确,任何人都有任何想法,请求建议我在PHP

中执行此操作

1 个答案:

答案 0 :(得分:0)

我现在得到答案,我发布这个答案给任何遇到像我这样的问题

convert your file from .doc to .html