Forum


Replies: 1   Views: 2583
Embedhtml - space in beginning and end
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 Brck  · 22-05-2018 - 13:11

Hi, 

In certain situations, I have text or html which begins and/or ends with a space. For instance:

$text = " and a previous sentence continues ";

$html " and a <i>previous</i> sentence continues ";

In using $docx->addText($text) the resulting docx include all spaces in the $text variable. Excellent.

In using $docx->embedHTML($html) then the first and last spaces (i.e. the " " before "and", the " " after "continues") are stripped. 

I have tried to replace any first or last space with &ensp; but that does not seem to correspond to ordinary spaces in the resulting docx. The &ensp; is larger than and ordinary space and does not show as a "dot" when i display formatting marks in Word/libreoffice.

 

Any idea?

Best regards,

B