-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Milestone
Description
This is:
- [x ] a bug report
- a feature request
- not a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword)
Expected Behavior
Should show the content of the second row, not only the heading.
Current Behavior
Does not parse a html table with multiple columns
Failure Information
Using the same html from the test HtmlTest.php: testParseTable, the test passes, but the content of the body is not generated correctly, at least opening the file in libreoffice 5.1.62
How to Reproduce
Please provide a code sample that reproduces the issue.
<?php
require __DIR__ . '/vendor/autoload.php';
$tmpDir = sys_get_temp_dir();
$outputPath = implode(DIRECTORY_SEPARATOR, array($tmpDir, 'writer.docx'));
$contents= '<table align="left" style="width: 50%; border: 6px #0000FF solid;">
<thead>
<tr style="background-color: #FF0000; text-align: center; color: #FFFFFF; font-weight: bold; ">
<th style="width: 50pt">header a</th>
<th style="width: 50">header b</th>
<th style="border-color: #00FF00; border-width: 3px">header c</th>
</tr>
</thead>
<tbody>
<tr><td style="border-style: dotted;">1</td><td colspan="2">2</td></tr>
<tr><td>This is <b>bold</b> text</td><td>5</td><td><p>6</p></td></tr>
</tbody>
</table>';
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $contents, false, $phpWord, $tmpDir );
$phpWord->save( $outputPath, "Word2007");
exec('libreoffice '.$outputPath);//requires linux and libreoffice installedContext
- PHP version:7.2.11
- PHPWord version: 0.14
- Debian with libreoffice
nixprosoft, rikvdlooi and jhoffmann