Forum


Replies: 5   Views: 2733
Replacevariablebyhtml nevers displays a table
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 intRE  · 16-01-2018 - 13:38

Hi,

 

When replacing a variable with HTML containing a table, it never displays the table, just the text in the table as a block of text. I am testing using a clean install, latest trial copy version, on openSUSE using example code I found in your documentation, specifically:

 

$html = '<table border="1" style="border-collapse: collapse" width="400">
            <tbody>
                <tr>
                    <td style="background-color: yellow">1_1</td>
                    <td rowspan="3" colspan="2">1_2</td>
                </tr>
                <tr>
                    <td>Some random text.</td>
                </tr>
                <tr>
                    <td>
                        <ul>
                            <li>One</li>
                            <li>Two <b>and a half</b></li>
                        </ul>
                    </td>
                </tr>
            </tbody>
        </table>';

$docx->replaceVariableByHTML('CHUNK_2', 'inline', $html, array('isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => false));

 

The result in the docx document:

1_11_2Some random text.OneTwo and a half

Any ideas? The functionality is crucial, the client large, and I'm getting nervous... 8)

Thanks,

Rian