Forum


Replies: 7   Views: 3581
Addhtml line spacing
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 c_h_r_i_s  · 07-06-2012 - 15:30

Hi,

When I do the following:

[code]
$html = '
<table border="0" style="width:158mm;">
<td style="padding:0px; background-color:#008080; text-align:left; padding:0pt 2pt;">
<span style="font-size:12pt; color:#FFFFFF; font-weight:bold; font-family:Tahoma,Arial;">SUMMARY AND ASSESSMENT CONCLUSION</span>
</td>
</table>';

$docx->addHTML($html);

$docx->setDefaultFont('Tahoma');

$docx->createDocxAndDownload('includes/reports/TEST');
[/code]

I get a table with some text in it but the text has a line spacing of 10pt below it. How can I remove the line spacing?

Thanks
Chris

Posted by bgauthier  · 11-04-2013 - 12:13

Have you found a solution for this problem? Would love to get the answer

Posted by admin  · 11-04-2013 - 12:13

Hello,

Methods that use altchunk tags, as addHTML or addDOCX, adds a line break before and after content. You can use add embedHTML instead of addHTML.

Regards.

Posted by isos  · 24-07-2013 - 09:29

Hello,



we've got the same problem with the awful automatic spacing. So we tried embedHTML but now we can't open the docx file and word says, that the start and end tags don't match. After this we just tried  adding a small table which doesn't work neither with the same word answer.



Regards.


Posted by bgcc  · 24-07-2013 - 10:26

Try to remove all line breaks in the html. That should fix the problem with the end tags.


Posted by admin-phpdocx  · 24-07-2013 - 11:17

It is very convenient to have tidy installed if you use the embedHTML method.



Depending on the XML parser carriage returns are sometimes interpreted as nodes, tidy takes care automatically of all those issues.



Moreover the extra spacing with addHTML methos has been solved since v 3.3.


Posted by isos  · 25-07-2013 - 19:34

Thank you very much!



Indeed Tidy is not installed. I'll write an email to the admins with the request for installing. Otherwise I'll try to use bgcc hint. I'll keep you in touch about that.



My phpdocx Pro+ is just ~10 days old. So I use v3.3. I can remove the spacing in the document with the Word function, but I want to do this every time ;)



cheers