Forum


Replies: 3   Views: 86
Space characters removed in createdocxfromtemplate process...

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?