Hi Community
I have a problem with my htmltext which i want to parse through power automate to generate a pdf file.
I have a nested Gallery, so I need nested tables in HTML. but forgive my HTML is not so much my thing.
This is part of my html text:
<table border=0 style='width:100%'>
"&
Concat(Gallery11.AllItems,"
<tr><td><b>"& Rubriek &"</td><td><b> €" &Sum(Gallery13.AllItems.ArtikelTotaal,ArtikelTotaal)&"</b></td>
<tr><table>
<tr>"&Concat(Gallery13.AllItems,"<td>"& ArtikelNaam &"</td>,<td>"& ArtikelAantal&" x "&"</td><td>"& ArtikelEenhPrijs& " = " &"</td><td>"&Round(Value(ArtikelTotaal),2) &"</td> </tr>
<tr><td><i>" & Beschrijving &"</i><td></tr>
</tr>")&"
</tr>")&"
</table>
</table>
The html preview in the app looks "almost" good
But the generated pdf looks very ugly. like everything stacked into one column. See screenshot in attachment
Any help is much appreciated! Thanks in front.
Bart
Solved! Go to Solution.
I'm sorry to say that you have a significant amount of HTML tag issues in your HTML. This may be "somewhat" okay in the HtmlViewer in PowerApps as it is "somewhat" forgiving. However, the PDF conversion will NOT be as forgiving. You need to get your tags correct and formatted properly.
Please consider changing your Formula to the following:
"<table border=0 style='width:100%'>" &
Concat(Gallery11.AllItems,
"<tr>
<td><b>"& Rubriek & "</b></td>
<td><b> €" & Sum(Gallery13.AllItems.ArtikelTotaal, ArtikelTotaal)& "</b></td>
</tr>
<tr>
<td colspan=2>
<table>" &
Concat(Gallery13.AllItems,
"<tr><td>" & ArtikelNaam & "</td><td>" & ArtikelAantal & " x </td><td>" & ArtikelEenhPrijs & " = </td><td>" & Round(Value(ArtikelTotaal),2) & "</td></tr>
<tr><td colspan=4><i>" & Beschrijving & "</i></td></tr>"
) &
"</table>
</td>
</tr>"
) &
"</table>"
)
I am not exactly sure your columns nor exactly how you wanted the Gallery information displayed, but at least the above if formatted correct and should convert to PDF without issue.
I hope this is helpful for you.
can you show how final PDF looks like?
I'm sorry to say that you have a significant amount of HTML tag issues in your HTML. This may be "somewhat" okay in the HtmlViewer in PowerApps as it is "somewhat" forgiving. However, the PDF conversion will NOT be as forgiving. You need to get your tags correct and formatted properly.
Please consider changing your Formula to the following:
"<table border=0 style='width:100%'>" &
Concat(Gallery11.AllItems,
"<tr>
<td><b>"& Rubriek & "</b></td>
<td><b> €" & Sum(Gallery13.AllItems.ArtikelTotaal, ArtikelTotaal)& "</b></td>
</tr>
<tr>
<td colspan=2>
<table>" &
Concat(Gallery13.AllItems,
"<tr><td>" & ArtikelNaam & "</td><td>" & ArtikelAantal & " x </td><td>" & ArtikelEenhPrijs & " = </td><td>" & Round(Value(ArtikelTotaal),2) & "</td></tr>
<tr><td colspan=4><i>" & Beschrijving & "</i></td></tr>"
) &
"</table>
</td>
</tr>"
) &
"</table>"
)
I am not exactly sure your columns nor exactly how you wanted the Gallery information displayed, but at least the above if formatted correct and should convert to PDF without issue.
I hope this is helpful for you.
@RandyHayes Thank you very much for fixing my html!
The structure of the table looks good now! 🙂
Any idea how I can get rid of the table borders? I suppose <table border=0 style='width:100%'> should do it, but clearly it doesn't.
edit: ok I found out just adding border=0 in the td tags helps 😉
I also added some styling like this
<tr style='background-color: #00ade2'>
it shows on screen, but not in pdf.
See here result so far.
Unfortunately to get formatting correct in both PowerApps and PDF, you have to "double style".
PDF would like to have mostly Internal styles (<style>) whereas PowerApps completely ignores internal styles and will only work with inline styles.
Take a look at a quick sample of this in this post from a couple weeks ago. Even though there was an issue with the html, it had nothing to do with the styles. In that you can see how the internal styles need to be put in.
User | Count |
---|---|
225 | |
101 | |
93 | |
56 | |
30 |
User | Count |
---|---|
286 | |
116 | |
109 | |
62 | |
57 |