Forum


Replies: 7   Views: 4145
Extra space on the beginning of every paragraph on html to doc
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 admin  · 20-11-2018 - 11:25

Thanks for sending the files. The problem is related to some configuration from PHP Tidy, that is doing a break for each word; we have tested your script in our test servers and the blank spaces don't appear.
 
phpdocx 8 added a new option to clean these breaks: removeLineBreaks ; but you can add support to phpdocx 7.5 easily.
 
Please edit the classes/CreateDocx.inc file, and in the embedHTML method, replaces the following lines:
 
if ($class == 'WordFragment') {
  $this->wordML .= (string) $sFinalDocX[0];
} else {
  $this->_wordDocumentC .= (string) $sFinalDocX[0];
}

with:

if ($class == 'WordFragment') {
  $this->wordML .= (string) str_replace(array("\n", "\r\n"), '', $sFinalDocX[0]);
} else {
  $this->_wordDocumentC .= (string) str_replace(array("\n", "\r\n"), '', $sFinalDocX[0]);
}

After this change the blank space in each line will disappear.

Regards.