使用php实现Word到html的转换
我正在linux服务器上工作。 我需要将word文件转换为html并按word文档中的显示方式显示 可以在没有.NET支持的Linux机器上转换它吗? 任何人对此有任何想法,请帮助我。使用php实现Word到html的转换,php,html,ms-word,Php,Html,Ms Word,我正在linux服务器上工作。 我需要将word文件转换为html并按word文档中的显示方式显示 可以在没有.NET支持的Linux机器上转换它吗? 任何人对此有任何想法,请帮助我。 我尝试了很多脚本,但它只显示文本内容,没有对齐。您可以从命令行使用LibreOffice soffice --headless --convert-to html file.doc 在PHP中,只需使用shell_exec或其他方法来调用它。您可以从命令行使用LibreOffice soffice --head
我尝试了很多脚本,但它只显示文本内容,没有对齐。您可以从命令行使用LibreOffice
soffice --headless --convert-to html file.doc
在PHP中,只需使用shell_exec或其他方法来调用它。您可以从命令行使用LibreOffice
soffice --headless --convert-to html file.doc
在PHP中,只需使用shell_exec或其他东西来调用它。最终我用Abiword获得了解决方案 使用安装abiword
yum install abiword
那么,下面是代码
<?php
$path=getcwd();
$cmd = 'abiword --to=html '.$path.'/test.docx';
exec($cmd);
$content=file_get_contents($path.'/test.html');
unlink($path.'/test.html');
echo urldecode($content);
?>
我终于用Abiword找到了解决方案 使用安装abiword
yum install abiword
那么,下面是代码
<?php
$path=getcwd();
$cmd = 'abiword --to=html '.$path.'/test.docx';
exec($cmd);
$content=file_get_contents($path.'/test.html');
unlink($path.'/test.html');
echo urldecode($content);
?>
Godspeed,孩子。“上帝啊,为什么?你知道这个问题吗?可能吗?上帝啊,孩子。“天哪!”哦,天哪,你知道这个问题吗?可能吗?