我們使用以下函數創建 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