Jump to content

Archived

This topic is now archived and is closed to further replies.

nigelf

Creating Word documents in PHP

Recommended Posts

Hi! I have discovered I can create Word documents in PHP using
header("Content-Type: application/msword");
header("content-disposition: attachment;filename=myfile.doc");
But I now need to format the documents by setting the Font (it seems to default to courier - I'd like Times Roman), making text Bold, setting Tabs and Page breaks, inserting Graphics.
Greatful for any help - thanks.

Share this post


Link to post
Share on other sites
That does not create a ms word document, all that does is tell the browser that you are sending content that represents a document that is in the format of a ms word document! You need to create the document before trying to send it. How you create the document will be dependent on the system you are running on, as PHP has no core function list that can create any typr of ms word documents!


me!

Share this post


Link to post
Share on other sites
I'm running PHP 5.0.3; Apache 2.0; Windows XP - is that the answer to your question?
Thanks Nigelf

Share this post


Link to post
Share on other sites
If you have MS Word installed on your system, then you can access MS Word, via PHP(s) COM interface. If you have it installed, tell me and I will give a simple example of creating a document and then allow you to download it or save it to add more stuff (images, pages)  later...

me!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.