Page 1 of 1
PHP: save report to MS Word document
Posted: Thu Sep 29, 2005 12:38 am
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...
Re: PHP: save report to MS Word document
Posted: Thu Sep 29, 2005 2:58 am
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
Posted: Thu Sep 29, 2005 3:20 am
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?