Forum


Replies: 5   Views: 3287
Styling html tables problems
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 erikdrums  · 20-04-2012 - 14:09

I'v been struggling with getting html tables styled so that I could control their width. Both the whole table tag but also just set the individual rows. Is this not possible with phpdocx_pro?
All the html is fine.
I should mention that I'm viewing the docx's in Microsoft Word 2008 on a mac

$html = '<table style="border-style: solid; width: 400px;">';
$html .= '<tr>';
$html .= '<td>first</td>';
$html .= '<td>second</td>';
$html .= '</tr>';
$html .= '</table>';
$docx->embedHTML($html);

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

Hello,

Please try embedHTML method that transforms HTML to WordML.

Regards.

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

Thanks for the reply!

Isn't that what I'm already using?

$html = ‘<table style=”border-style: solid; width: 400px;”>’;
$html .= ‘<tr>’;
$html .= ‘<td>first</td>’;
$html .= ‘<td>second</td>’;
$html .= ‘</tr>’;
$html .= ‘</table>’;

HERE:
[b]$docx->embedHTML($html);[/b]

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

Hi,

Sorry, I meant addHTML.

Regards.

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

I then get an error when I open it in Word, saying the file is damaged and can't be opened?