如何在HTML / PHP中显示格式化的Word Doc?
作者:互联网
在HTML / PHP中显示格式化Word Doc的最佳方法是什么?
这是我目前的代码,但它没有格式化它:
$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("ACME.doc"));
// Extract content.
$content = (string) $word->ActiveDocument->Content;
echo $content;
$word->ActiveDocument->Close(false);
$word->Quit();
$word = null;
unset($word);
解决方法:
我对COM一无所知,但在MSDN上浏览Word API文档,看起来你最好的选择是使用Document.SaveAs
将wsFormatFilteredHTML
保存为临时文件,然后将该HTML提供给用户.一定要选择过滤后的HTML,否则你将获得最有趣的标签汤.
标签:php,ms-word,openxml,doc-2 来源: https://codeday.me/bug/20190730/1579320.html