...

View Full Version : changing word file



dizyn
03-14-2007, 07:07 PM
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


<?PHP
$tmp= file_get_contents("work.doc");
$tmp = str_replace ("sys" , "asd",$tmp);
$tmp= file_put_contents("work2.doc" , $tmp);
?>

Fumigator
03-14-2007, 07:35 PM
Yeah good luck with that... a Word file is a far cry from a plain text file and you can't expect to be able to treat it like a plain text file.

Inigoesdr
03-14-2007, 09:02 PM
Yeah, word documents are filled with extra formatting information along with the text. You might have better luck trying to find a class (http://www.phpclasses.org/browse/package/3553.html) to help you modify the file.

dizyn
03-15-2007, 10:01 AM
i think supports OLE Container format (that of doc files) can do something
but not sure of it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum