How to open and write a MS word Doc in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dharprog
Forum Contributor
Posts: 126
Joined: Fri Oct 27, 2006 12:20 am

How to open and write a MS word Doc in PHP

Post by dharprog »

Hi,

How to open and fill MS Word and MS Excel template file and write it back into with new file name in PHp?

Thank You
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Post by Jade »

You might find it easier to format the data with php (to the template specifications) and then export the data in the format you need, instead of worrying about opening templates and writing to them.
wyrmmage
Forum Commoner
Posts: 56
Joined: Sat Oct 28, 2006 12:43 pm
Location: boise, ID

Post by wyrmmage »

well, I believe that MS uses XML for all of its documents, so you're going to have to look at the XML structure and then fill in the tags appropriately; it's a bit of a big question to just ask for source code for ;)
brendandonhue
Forum Commoner
Posts: 71
Joined: Mon Sep 25, 2006 3:21 pm

Post by brendandonhue »

If you have Word/Excel installed you can use COM objects to manipulate them.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

XML is (only) supported in the newer flavors of Word/Excel. I wouldn't bank on everyone having them.

Personally, I would recommend using RTF and CSV respectively; even PDF if the documents don't need to be editable.
sinedas
Forum Newbie
Posts: 1
Joined: Fri Jun 01, 2007 2:53 pm

You can use PhpRtf library

Post by sinedas »

My reply maybe is too late. You can use PhpRtf library for creating rtf documents. The address there you can download sourses is http://www.phprtf.com.
Post Reply