如何从跨一个以上页面的php创建一个MsWord(.doc)文件(使用html) [英] How to create a MsWord (.doc) file from php that spans more than one page (using html)

查看:101
本文介绍了如何从跨一个以上页面的php创建一个MsWord(.doc)文件(使用html)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个具有多个页面的.doc文件.我想从html创建doc文件(设置标题以便将其解释为doc文件),但是我不知道如何在html中添加可以从单词中正确识别的分页符.

i need to create a .doc file that has more than one page. I want to create the doc file from html (setting the headers so that it is interpreted as a doc file) but i don't know how to add a page break in html that is correctly recognized from word.

先感谢

推荐答案

您可能会发现 PHPWord 是有用.

PHPWord是一个用PHP编写的库 会创建Word文档.

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

更新:

方法一:

这是使用COM的方法(需要安装Word)

Here is a method using COM (requires Word to be installed)

方法二:

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

Use appropriate headers, here is an example:

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>";

这篇关于如何从跨一个以上页面的php创建一个MsWord(.doc)文件(使用html)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆