hi guys! here is my problem... I have to append a string "See the solution file" in at the end of almost 3000 MS word (.doc) files. I am using this $file="filename.doc"; $fp=fopen($file, "a+"); $cmnt="See the solution file"; fwrite($fp, $cmnt); fclose($fp); it works fine if i use $file="filename.txt"; or $fp=fopen($file,"w+"); txt file(need to update doc) (writing whereas i need to append data) what to do? need solution on urgent basis... thanks in advance
<?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; ?> --------------------------------------------------------
its not working...i need to append data in already existing files... whereas this code is writing text to a new word file, removes previous data and ask to save...it would be hazard to save 3000 files.