gpt4 book ai didi

html - 如何从跨越多个页面的 php 创建 MsWord (.doc) 文件(使用 html)

转载 作者:太空宇宙 更新时间:2023-11-04 15:25:10 24 4
gpt4 key购买 nike

我需要创建一个不止一页的 .doc 文件。我想从 html 创建 doc 文件(设置标题以便将其解释为 doc 文件)但我不知道如何在 html 中添加分页符以从 word 中正确识别。

提前致谢

最佳答案

您可能会发现 PHPWord有用。

PHPWord is a library written in PHP that create word documents.

更新:

方法一:

Here is a method using COM (需要安装Word)

方法二:

使用适当的标题,这里是一个例子:

header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=document_name.doc");

echo "<html>";
echo "<body>";
echo "<b>My first document</b>";
echo "</body>";
echo "</html>";

关于html - 如何从跨越多个页面的 php 创建 MsWord (.doc) 文件(使用 html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3342605/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com