jake2891 Posted May 18, 2009 Share Posted May 18, 2009 Hi, im trying to replace tags in a word document using a php script i wrote. for example ill have the tags like this %tag_to_replace% the problem is that when ever i upload the document and view the xml source the tag has been split up into 4-5 different lines depending on the length of the tag. So when i come to search for the tag in my php and replace it, it cant match it up because the tag looks something like this. % some xml tags tag_ some xml tags to some xml tags etc.. I know word sees this tag as an error and puts most of the tags between error tags so ive done some formatting of my own using php to try fix this as best as possible but i cant accomidate for all the different types of situations every document seems to be different. has anyone ever had to deal with this and knows a way around this or does anyone know of a script available to fix this? thanks Link to comment https://forums.phpfreaks.com/topic/158636-replacing-tags-in-a-word-document/ Share on other sites More sharing options...
Hybride Posted May 19, 2009 Share Posted May 19, 2009 Have you tried using preg_match? PHP's page on preg_match. Link to comment https://forums.phpfreaks.com/topic/158636-replacing-tags-in-a-word-document/#findComment-836948 Share on other sites More sharing options...
jake2891 Posted May 19, 2009 Author Share Posted May 19, 2009 yeah i have been using preg_match and preg_replace. I was looking into COM yesterday aswell but seems like that requires windows version of php. As then i could of replaced the tags using the word engine itsself. Link to comment https://forums.phpfreaks.com/topic/158636-replacing-tags-in-a-word-document/#findComment-837038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.