Forum


Replies: 3   Views: 218
Space characters removed in createdocxfromtemplate process...
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 miso  · 04-12-2024 - 15:28

Hmm... this is a challenge now, as we don't know to "fix" this.

Here's our code:

     $docx = new CreateDocxFromTemplate($input_file);
        $docx->setTemplateSymbol('%%', '%%');
        $first = 'phpdocx';
        $docx->replaceVariableByText($replacements);
        $docx->createDocx($output_file);

And in the $input_file there's a section of text that's separated and spaced out by blank spaces:

https://img001.prntscr.com/file/img001/EuYShWv7Q-KK2SOZqIg9Sg.jpeg

But in the $output_file that section ends up looking like this, with all the space characters removed:

https://img001.prntscr.com/file/img001/Sh3mYRNmTsGzeAEkoO64VA.jpeg

What are we missing?

Is there some sort of a parameter we can pass to that process/function to ignore space characters? Because we have 100+ of these templates that otherwise we'd have to go in and fix manually, set up this section of text in a table or something, I assume, that would convert better with phpdocx?

Suggestions?