Reputation: 329
I'm having troubles with transforming .docx to html... I'm using PHPDOCX FREE to handle this problem... I have some problems with it and I was able to determine where the problem was.. it's in the next piece of code:
$xmlDOM = new DOMDocument();
$xml = str_replace('</w:wordDocument>', '', $xml);
$xml = preg_replace(
'/(<w:wordDocument)+(.)*(><w:body>)/', '<w:body>', $xml
);
escpecially in the 'preg_replace' function... it's making the server so busy... so I can't work anything until I restart the server...
Upvotes: 2
Views: 2731
Reputation: 7739
Try replacing this :
$xml = preg_replace(
'/(<w:wordDocument)+(.)*(><w:body>)/', '<w:body>', $xml
);
By this :
$xml = preg_replace(
'/<w:wordDocument.*?><w:body>/', '<w:body>', $xml
);
Or just (if the wordDocument tag is always folowed by body tag) :
$xml = preg_replace(
'/<w:wordDocument.*?>/', '', $xml
);
Using parentheses makes php use more mamory. Wich PHP version you got ?
Upvotes: 1