-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Table in string not showing properly and break file content #2354
Labels
Comments
Sorry for my english, if it's not clear |
Try using $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$header = ['size' => 16, 'bold' => true];
$section->addText('addHtml with theader AND tbody', $header);
$table = '
<html lang="fr"><body>
<table>
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
</tr>
</tbody>
</table>
</body></html>
';
PhpWordHtml::addHtml(
$section,
$table,
true
);
$path = '/tmp/table.docx';
$phpWord->save($path); Result: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the Bug
I can't create the table manually to PHPWord because users should be able to modify the content to export from the app, that's why I get the content and try to genrate a word file, when the string content contain table an cells , tables are not showing properly and even the file content is incomplet
A clear and concise description of what the bug is.
When content not containing table, my file is generated like a charm, but when table are there, my file is broken.
Also, when there is no tbody/thead tags : my table is here.
I found this :
Using table tag in HTML Reader produces no output
It is too old and I can't modify core code, but it seems that tbody/thead are not DOMElements.
Steps to Reproduce
Please provide a code sample that reproduces the issue.
Expected Behavior
A clear and concise description of what you expected to happen.
Word file with complete content and inline designed tables.
Current Behavio
What is the current behavior?
Breaked file and tables
Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: