I'm replacing what I created in HTML with the word template with replaceVariableHTML.
At that time, I am creating a table, but a blank row under the table is created. Is there a way to remove this blank line?
I'm replacing what I created in HTML with the word template with replaceVariableHTML.
At that time, I am creating a table, but a blank row under the table is created. Is there a way to remove this blank line?
source
<div class="section">
<p class="sSectionTitle">TITLE</p>
<p class="indentStyle">
<span class="sectionNumber">NUMBER</span> AAAAAAA
</p>
<ul class="numList">
<li>BBBBBBBBBBBBBBBBBbb
<table class="teigakuTable" border="0" cellpadding="0" cellspacing="0" style="width:98%;">
<tr>
<td style="width:10%"> </td>
<td style="width:35%">1. AAAAAA</td>
<td style="width:55%">BBBB</td>
</tr>
<tr>
<td style="width:10%"> </td>
<td>2.BBBBBB</td>
<td>CCCCCC</td>
</tr>
<tr>
<td style="width:10%"> </td>
<td>3.CCCCCC</td>
<td>DDDDDDDDDDDDDDDDDDDDD</td>
</tr>
</table>
</li>
<li>COMMENTTTTTTT</li>
</ul>
</div>
Hello,
We have run the following code using phpdocx 10:
$docx = new CreateDocx();
$html = '
<div class="section">
<p class="sSectionTitle">TITLE</p>
<p class="indentStyle">
<span class="sectionNumber">NUMBER</span> AAAAAAA
</p>
<ul class="numList">
<li>BBBBBBBBBBBBBBBBBbb
<table class="teigakuTable" border="0" cellpadding="0" cellspacing="0" style="width:98%;">
<tr>
<td style="width:10%"> </td>
<td style="width:35%">1. AAAAAA</td>
<td style="width:55%">BBBB</td>
</tr>
<tr>
<td style="width:10%"> </td>
<td>2.BBBBBB</td>
<td>CCCCCC</td>
</tr>
<tr>
<td style="width:10%"> </td>
<td>3.CCCCCC</td>
<td>DDDDDDDDDDDDDDDDDDDDD</td>
</tr>
</table>
</li>
<li>COMMENTTTTTTT</li>
</ul>
</div>
';
$docx->embedHTML($html);
$docx->createDocx('output');
And there's no blank rows after the table when opening the document. We have opened the output with MS Word (2007, 2010, 2013, 2016, 2019, 365 and Online) and LibreOffice (5, 6 and 7) and in all cases the output is correct. What DOCX reader are you using? Maybe you are applying some extra style or your template has some extra content?
If you send to contact[at]phpdocx.com the most simple script (and the template) that illustrates the issue and the output you get we'll check them.
Regards.
thank you for your answer.
When I checked here, I couldn't confirm the blank line.
However, when I create the following consecutive tables, a blank row is created between them.
<table border="0" cellpadding="0" cellspacing="0" style="width:98%;">
<tbody><tr><th>THHHHH</th><td>TRRRR</td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" style="width:98%;">
<tbody><tr><th>THHHHH</th><td>TRRRR</td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" style="width:98%;">
<tbody><tr><th>THHHHH</th><td>TRRRR</td></tr></tbody></table>
<div>DIV<p>P</p>DIV</div>
Hello,
That's a MS Word limitation. MS Word requires adding at least one paragraph between tables. If you open MS Word you can try it: after adding a table to a document and then you try to add another table, MS Word doesn't allow it unless you add at least a paragraph.
You can get the minimum space between tables adding a paragraph between them and setting the spacing and font-size to the minimum value:
http://www.wordbanter.com/showthread.php?t=123470
You can change spacing and font-size values with phpdocx.
Using removeWordContent from DOCXPath you can force removing that paragraphs between tables that MS Word requires, but please note that then MS Word may display a corrupted document error when trying to open it.
Regards.