我们使用以下函数创建 docx 文档:
require('grabzit/lib/GrabzItClient.class.php');
// require("grabzit/config.php");
$grabzIt = new GrabzItClient("...xxx...");
$grabzIt->HTMLtoDOCX(“这里有一些内容”);
header('内容类型:应用程序/八位字节流');
header('Content-Disposition: 附件; filename="'.$GLOBALS{TSFE}->id.'.docx"');
$GLOBALS['TSFE']->内容 = $grabzIt->SaveTo();
文件是 saved 但是当打开 docx 时,Word 显示“打开文档时出错...”
有什么事吗
请访问此页面:https://grabz.it/html-to-word-docx-api.aspx
然后使用框中的 HTML 创建捕获并打开该文件。
是否出现错误?
API 页面中的示例会导致相同的错误。 $GLOBALS['TSFE']->content 正确输出内容 into saved docx,这样就可以用写字板正确打开docx了。 只有 MS Word 会导致此错误。
你可以在这里尝试一下 https://www.liesegang-partner.de/print/mustervertraege/unternehmenskauf/unternehmenskaufvertrag-share-deal-gmbh.html?doctype=word&attachment=1
请参阅此处的示例 https://www.liesegang-partner.de/print/mustervertraege/unternehmenskauf/unternehmenskaufvertrag-share-deal-gmbh.html