Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    May 2006
    Posts
    107
    Thanks
    1
    Thanked 0 Times in 0 Posts

    changing word file

    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 Code:
    <?PHP
        $tmp
    =    file_get_contents("work.doc");
        
    $tmp str_replace ("sys" "asd",$tmp);
        
    $tmp=    file_put_contents("work2.doc" $tmp);
    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Yeah, word documents are filled with extra formatting information along with the text. You might have better luck trying to find a class to help you modify the file.

  • #4
    Regular Coder
    Join Date
    May 2006
    Posts
    107
    Thanks
    1
    Thanked 0 Times in 0 Posts
    i think supports OLE Container format (that of doc files) can do something
    but not sure of it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •