PHP: save report to MS Word document

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
pqres
Forum Newbie
Posts: 4
Joined: Thu Sep 29, 2005 12:08 am

PHP: save report to MS Word document

Post by pqres »

Dear All,

I am new to PHP and facing the problem of saving some reports in MS Word format.
The difficulty is there are header and footer required, so we cannot save it directly.
Is there sample or discussion about it? Thanks!



regards...
omega-systems
Forum Newbie
Posts: 14
Joined: Tue Sep 27, 2005 5:01 am
Contact:

Re: PHP: save report to MS Word document

Post by omega-systems »

Read more about COM in Php.
For instance for word:

Code: Select all

// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible = 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word->Release();
$word = null;
Regards,
Michael.

Project Manager
Omega Systems Ltd
Email: info@omega-systems.biz
ICQ: 264962449
MSN: omega-systems@hotmail.com
AIM: OmegaSys Ltd
pqres
Forum Newbie
Posts: 4
Joined: Thu Sep 29, 2005 12:08 am

Post by pqres »

I have this php file querying the database, formating and showing the report. Is there simple way to convert the php page into a local MS Doc file with header and footer?
Post Reply