I have been searching through the Internet searching for a solution to my problem. I am currently using CakePhp + dompdf to generate a PDF. It works fine on normal tables, but when I add rowspans and colspans it creates the table but the borders are ruined.
This is my HTML markup for generating the PDF:
<style>table{border-collapse:collapse;}.rows td{border:1px solid brown;</style>
<table class="sub_cat_table">
<tbody><tr class="rows">
<td colspan="2">カテゴリ</td>
<td>重要度</td>
<td>実現度</td>
<td colspan="2">項目(キーワード)</td>
<td colspan="2">重要度</td>
<td colspan="2">実現度</td>
<td colspan="2">格差</td>
</tr>
<tr class="rows">
<td rowspan="2" class="sub_cat_letter"> A </td>
<td rowspan="2" class="sub_cat_name">Situation</td>
<td rowspan="2" class="sub_cat_imp">3.5</td>
<td rowspan="2" class="sub_cat_pos">2.0</td>
</tr>
<tr class="rows">
<td class="sub_cat_number">1</td>
<td class="sub_cat_name">Complete</td>
<td class="sub_cat_imp_inner">3.0</td>
<td class="sub_cat_imp_inner"></td>
<td class="sub_cat_imp_inner">2.0</td>
<td class="sub_cat_imp_inner"> ●</td>
<td class="sub_cat_imp_inner">-1</td>
<td class="sub_cat_imp_inner"></td>
</tr>
<tr class="rows">
<td class="sub_cat_number">2</td>
<td class="sub_cat_name">Access</td>
<td class="sub_cat_imp_inner">4.0</td>
<td class="sub_cat_imp_inner"></td>
<td class="sub_cat_imp_inner">2.0</td>
<td class="sub_cat_imp_inner">● </td>
<td class="sub_cat_imp_inner">-2</td>
<td class="sub_cat_imp_inner"></td>
</tr>
<tr class="rows">
<td rowspan="3" class="sub_cat_letter">B</td>
<td rowspan="3" class="sub_cat_name">Technology</td>
<td rowspan="3" class="sub_cat_imp">3.4</td>
<td rowspan="3" class="sub_cat_pos">1.9</td>
</tr>
<tr class="rows">
<td class="sub_cat_number">3</td>
<td class="sub_cat_name">Quality</td>
<td class="sub_cat_imp_inner">3.7</td>
<td class="sub_cat_imp_inner"></td>
<td class="sub_cat_imp_inner">1.7</td>
<td class="sub_cat_imp_inner"></td>
<td class="sub_cat_imp_inner">-2</td>
<td class="sub_cat_imp_inner">▼ </td>
</tr>
<tr class="rows">
<td class="sub_cat_number">4</td>
<td class="sub_cat_name">Access</td>
<td class="sub_cat_imp_inner">3.0</td>
<td class="sub_cat_imp_inner"></td>
<td class="sub_cat_imp_inner">2.0</td>
<td class="sub_cat_imp_inner">● </td>
<td class="sub_cat_imp_inner">-1</td>
<td class="sub_cat_imp_inner"></td>
</tr>
</tbody>
</table>
Print screen in HTML (sorry, the table has border above):
Print screen in generating PDF in dompdf:
I've been trying to play with the file dompdf/includes/cellmap.cls.php
, but I can't get it to work.
I already tried these solutions here:
And some links I already forgot. Any advice or workaround is very much appreciated.
I think you don't need to change your dompdf to create PDF, You just need to arrange your table specially the row span rule. When creating a table using row span it should be like this:
<table border="1">
<tr>
<td rowspan="3"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>