cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

HTML text for PDF

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

BClouded_0-1601737786201.png

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



1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@BClouded 

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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

4 REPLIES 4
Helper I
Helper I

can you show how final PDF looks like?

Super User III
Super User III

@BClouded 

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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

@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.

 

@BClouded 

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.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (26,702)