开发者

How to create a MsWord (.doc) file from php that spans more than one page (using 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.

Thanx in adv开发者_开发问答ance


You may find PHPWord to be useful.

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

Update:

Method One:

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

Method Two:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜