Forum


Replies: 5   Views: 2278
Searchandreplace by bland space does not work
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by legalvision  · 19-02-2019 - 16:22

Hi there,

I have a searchAndReplace by blank spaces as follow:

$newDocx->searchAndReplace(
    'myFile.docx',
    'myFile2.docx',
    ' ' . $placeholder . ' ',
    '       '
);

I am pretty sure this use to work, but does not anymore. I have checked in the searchAndReplace function and the $node->nodeValue output seems to be fine. My guess is that this has something do to with the underlying XML and how Microsoft deals with it. What made me think that is that if I open the resulting Word document, there is no space. But if I preview it (space bar in MacOS), I can see the spaces.

Any idea how to replace a placeholder by blank space ? My goal here is to remove a placeholder by searchAndReplace, and not have 2 spaces remaining, but just one.