Forum


Replies: 3   Views: 5728
Pdf table width columns
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 magira  · 16-02-2016 - 08:16

Hello, I allready set the table and td width. Look my executed code : 

$docx = new CreateDocx();

$html='
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
                <title>Title of the document</title>
                
                <style type="text/css">
                        table {border: 1px solid green; }
                        table, tr, td {padding : 15px;}
                </style>
        </head>
        <body>
                <table width="475px">
                        <colgroup>
                                <col width="75" style="background-color:red; width:75px;">
                                <col width="400" style="background-color:yellow; width:400px;">
                        </colgroup>
                        <tr>
                        <td width="75" style="width:75px;">Cell 1 1</td>
                        <td width="400" style="width:400px;">Cell 1 2</td>
                    </tr>
                    <tr>
                        <td width="75" style="width:75px;">Cell 2 1</td>
                        <td width="400" style="width:400px;">Cell 2 2</td>
                    </tr>
                </table>
        </body>
</html>';
 
$docx->embedHTML($html);

$docx->createDocx('./result/10_transform_html_to_docx_multiple_table');

$docx = new TransformDocAdv();

$docx->transformDocument('./result/10_transform_html_to_docx_multiple_table.docx',
                './result/10_transform_html_to_docx_multiple_table.pdf',
                $tmp,
                array('odfconverter' => true, 'debug' => true));

I found the solution by removing one modification in your library on HTML2WordML:1343. 

self::$WordML = str_replace('#<w:gridCol/>#', str_repeat('<w:gridCol w:w="1"/>', $column), self::$WordML);


// to
self::$WordML = str_replace('#<w:gridCol/>#', str_repeat('<w:gridCol/>', $column), self::$WordML);

Please check the importance of this modification on your code...