Jump to content

WillyTheFish

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

WillyTheFish's Achievements

Member

Member (2/5)

0

Reputation

  1. The String contains a value between the tags aswell "Engagerad", which got stipped aswell. I solved this by using the following regex: $regex_strip_tags = "/<[\/\!]*?[^<>]*?>/"; $result[1][] = preg_replace($regex_strip_tags,'',$snippets[0][$key]);
  2. Hey guys! I tried to use strip_tags() on this string, but the function will return a null-string for some reason? Any idea why, and any suggestion how to solve this? $string = '<Word.Bookmark.Start" w:name="a"/><w:p><w:pPr><w:jc w:val="center"/><w:rPr><w:sz w:val="16"/><w:sz-cs w:val="16"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial"/><wx:font wx:val="Arial"/><w:b/><w:highlight w:val="light-gray"/></w:rPr><w:t>Engagerad</w:t></w:r><aml:annotation aml:id="0" w:type="Word.Bookmark.End>'; echo strip_tags($string); // returns nothing, nada... thank you
  3. ahh thank god.. works fine with preg_match_all(). First array is trash though, but i can live with that, second one is beautiful thanks alot sasa!!!!!!
  4. nope, unfortunately i cannot use strip_tags... i have to solve this using regex, because i need to determine the position where the data was extracted later on and will be using the same regex twice =/
  5. ops, sorry i'm stupid, forgot to print it right... actually, both elements are incorrect Array ( [0] => "Word.Bookmark.Start" w:name="something"/> <w:r><w:rPr><w:sz w:val="24"/> </w:rPr><w:t>THIS IS THE TEXT I WANT TO EXTRACT!</w:t></w:r><w:r><w:rPr><w:sz w:val="24"/></w:rPr><w:br/> </w:r><aml:annotation aml:id="2" w:type="Word.Bookmark.End" [1] => <w:r><w:rPr><w:sz w:val="24"/> </w:rPr><w:t>THIS IS THE TEXT I WANT TO EXTRACT!</w:t></w:r><w:r><w:rPr><w:sz w:val="24"/></w:rPr><w:br/> </w:r> )
  6. I tested your regex with another file, but that didn't work at all the format is still the same though. But yeah, the second element of the array is correct!
  7. thanks sasa, almost... this regex gives me two arrays: array(2) { [0]=> string(242) ""Word.Bookmark.Start" w:name="something"/> THIS IS THE TEXT I WANT TO EXTRACT! string(147) " THIS IS THE TEXT I WANT TO EXTRACT! " } could you have another look at it? thank you so much!
  8. Well I tried simplexml_load_file() but that resulted in an empty object... but to be honest, i don't know how to do it... any suggestions?
  9. Hey guys, this is probably pretty simple, but I really have a problem with regex. This is the input string: </w:r><w:r><w:rPr><w:b/><w:sz w:val="24"/></w:rPr><w:br/></w:r><w:r><w:rPr><w:b/> <w:sz w:val="24"/></w:rPr><w:br/></w:r><aml:annotation aml:id="2" w:type="Word.Bookmark.Start" w:name="something"/> <w:r><w:rPr><w:sz w:val="24"/> </w:rPr><w:t>THIS IS THE TEXT I WANT TO EXTRACT!</w:t></w:r><w:r><w:rPr><w:sz w:val="24"/></w:rPr><w:br/> </w:r><aml:annotation aml:id="2" w:type="Word.Bookmark.End"/><w:r><w:rPr><w:sz w:val="24"/></w:rPr><w:br/></w:r><w:r><w:rPr> <w:sz w:val="24"/></w:rPr><w:br/></w:r><w:r><w:rPr><w:sz w:val="24"/><w:highlight w:val="light-gray"/></w:rPr><w:t>NO MATCH</w:t> I want to match the text between "Word.Bookmark.Start" and "Word.Bookmark.End", but not the tags inbetween. So the match of the RegEx in the example above should be: "THIS IS THE TEXT I WANT TO EXTRACT!" I do not want to extract the text "NO MATCH", since it is not located between "Word.Bookmark.Start" and "Word.Bookmark.End". I wanna gather all matches in an array. Please help! Many thanks
  10. hm okay thanks... to be honest I don't get it... how do I process a .doc file with this library?
  11. Hey guys, any suggestions how i could read and write msWord files without using the COM interface. I need to keep all the formatting intact though... any ideas? many thanks
  12. yeah it's me again.... now I downloaded and tried this script/class and left it unchanged... still doesn't work: http://www.phpclasses.org/package/3553-PHP-Edit-Microsoft-Word-documents-using-COM-objects.html there must be something wrong with my php-settings or my ms Word installation i guess? COM is enabled in phpinfo()! Any suggestions....? I really need to get this to work thanks!
  13. Hey guys, I've been searching the forum, but haven't found a post describing the following problem: I want to Open and Manipulate a word document using the COM class. This is my code so far: $Wrd = new COM("Word.Application"); $DocName = TEMPLATE_DIR.'template.doc'; $Wrd->Application->Visible = True; $WrdDoc = $Wrd->Documents->Open(realpath($DocName)); # do something here $WrdDoc->SaveAs(realpath($DocName)); $Wrd->ActiveDocument->Close(false); $Wrd->Quit(); $Wrd = NULL; There's no problem creating the COM-object, but when i try $WrdDoc = $Wrd->Documents->Open(realpath($DocName)); the browser is either complaining about insufficient memory or will chew on the code for ages... I can see that a temporary word file is created, so it seems that the document has been opened... still, the browser is working and working.... can anyone tell me what's going on? Many Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.