Page 1 of 1
operations on MS word file
Posted: Tue Mar 13, 2007 3:15 pm
by itsmani1
Can I perform operatrions on MS word file using php? If I can than is there a special way to do so?
For example there is file abc.doc
It contains a line " Hello [[field1]],"
Now i want to find and replace this [[field1]] by "Mike"
How can i do this?
Output will be:
Hello Mike,
Thank you
Posted: Tue Mar 13, 2007 6:05 pm
by RobertGonzalez
Have a search of PHPClasses.org. I am sure there are file exporting and importing classes that you could use there.
Posted: Wed Mar 14, 2007 2:35 am
by itsmani1
What if i try to convert word file to an html file?
Posted: Wed Mar 14, 2007 12:12 pm
by itsmani1
I am trying this code to edit word file, it works fine if the both strings are same lenght but not if both are of different length.
any help
Code: Select all
<?PHP
$tmp= file_get_contents("work.doc");
$tmp = str_replace ("sys" , "asd",$tmp);
$tmp= file_put_contents("work2.doc" , $tmp);
?>
Posted: Wed Mar 14, 2007 12:14 pm
by feyd
Word files are binary, you cannot simply
str_replace() things in them.
Posted: Wed Mar 14, 2007 1:49 pm
by Xoligy
Why not use mail merge?
Posted: Thu Mar 15, 2007 2:53 am
by itsmani1
what is mail merge?