Payday Loans - Personal Loans - Debt Consolidation - Wordpress Themes - Find jobs

PDA

View Full Version : Save online msdocument in server


ksamir2004
May 9th 2008, 12:42 am
Hi all,

i want to create word document in server and save it to in server..
i got script but this script create word document in client machine..
Can any one help me to write this script.


<?php
header('Content-type: application/msword');
header('Content-Disposition: attachment; filename="download.doc"');
readfile('thefilename of the doc');
?>

ketan9
May 9th 2008, 6:56 am
You need a windows server to do what you are asking for. Here's a small sample for you <?php
$word = new COM("word.application") or die ("couldnt create an instance of word");
echo "loaded , word version{$word->version}";
//bring word to the front
$word->visible = 1;
//open a word document
$word->Documents->Add();
//add some text to the document
$word->Selection->TypeText("this is some sample text in the document");
//save the document as sampleword.doc
$word->Documents[1]->SaveAs("sampleword.doc");
//close word
$word->Quit();
//free object resources
$word->Release();
$word = null;
?>

More details at http://www.programmershelp.co.uk/phpcreateword.php