Closed daniel-johnsson closed 2 years ago
Thanks for the suggestion. I'll need time to review it.
As you saw, dealing with tables is quite complex 😅
If the width is set to a percentage it will be set to auto if colspan is set
Actually, only the HTML attribute width
is really supported when there is a colspan
. Dealing with the width+colspan is difficult… So I won't change the support until someone really asks for a specific example.
In the meantime, for your case, I changed the code to ignore colspan < 2
(not available in current version as it's a very minor change and it will only be released with the next one).
I would assume that we want to convert all
auto
to a format that works in pdfMake.
I'm not sure to understand what you mean? auto
is a valid value for PDFMake:
Yeah sorry for the bad phrasing, auto
is valid. What I meant was that, from what I can understand if the table is set to 100% width and all cells are auto
they will be converted to *
. However if one of the columns is a fixed width, this will not happen and the table will not scale up to 100% width.
<table style="width:100%">
<tr>
<td style="width:50px">Cell A1</td>
<td>Cell A1</td>
</tr>
</table>
Ah OK I understand now. I've just published the v2.4.7 with the changes.
Thanks
First of all thanks for a great package, this really is a lifesaver.
I found some issues when tinkering around with tables, I already have fixed these issues manually with some pre/post-processing. Just wanted to report them so they might be resolved in a nicer fashion.
If the width is set to a percentage it will be set to auto if colspan is set:
With colspan
"widths": ["auto", "auto"]
Without colspan
"widths": ["20%", "auto"]
I assume that it breaks on this line and is converted to
auto
Second issue is that
auto
is only converted too*
if all widths areauto
. I would assume that we want to convert allauto
to a format that works in pdfMake.My suggestion would be to change the code here Replaced with:
Let me know if I can assist in any way :)