I want to create new Word Template file which will have a field to put the Student name.
All other text, images will remain same except the student name.
Then I want to save the same file on the harddrive.
Please let me know how do I go ahead.
Thanks,
Dodo.
Edit Word file(edit Fields in it) and save it thru PHP code
Moderator: General Moderators
-
sujithtomy
- Forum Commoner
- Posts: 46
- Joined: Tue Mar 24, 2009 4:43 am
Re: Edit Word file(edit Fields in it) and save it thru PHP code
Hello,
On windows you can use COM module.....
example:
more details on : http://in.php.net/manual/en/class.com.php
On windows you can use COM module.....
example:
Code: Select all
<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "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 = null;
?>