Jump to content


Photo

Creating Word documents in PHP


  • Please log in to reply
3 replies to this topic

#1 nigelf

nigelf
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 18 October 2006 - 02:19 PM

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.

#2 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 18 October 2006 - 02:26 PM

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!

#3 nigelf

nigelf
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 18 October 2006 - 02:45 PM

I'm running PHP 5.0.3; Apache 2.0; Windows XP - is that the answer to your question?
Thanks Nigelf

#4 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 18 October 2006 - 03:37 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users