Jump to content

Creating Word documents in PHP


nigelf

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.
Link to comment
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!
Link to comment
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.