cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Knich
Level: Powered On

Powerapps HtmlText to PDF Conversion Flow - Formatting

I am using a flow to create a PDF from HtmlText in PowerApps. It crates the .html with the correct format but the .pdf is incorrectly formatted.

My end goal is to pruduce a dynamic table based off of user imputs, but i am not sure if my html is incorrect in PowerApps, Flow, or both.

User imputs in PowerApps are first captured into a collection, then converted into a table HtmlText, then the table passes through the flow on selecting a button.

 

Please advise,

 

 HtmlText in Powerapps

"<table width='100%'> " &
"</table> <br>" &
"<table width='100%' border='1' style='border:1px solid black; border-collapse:collapse'>" &
     "<tr style='background-color:#efefef'>
         <th align=left></th> <th align=right> Cost </th> <th> # of Labors </th><th align=right> Subtotal </th><th> Hours </th><th align=right> TOTAL </th>
     </tr>
     <tr>" &
Concat(COlaborers,
        "<td align=left> 
            <b>"& Classification &"</b>
            <br> Base Pay 
            <br> Labor Burden
            <br> Benefits
            <br> <b>Total Hourly Rate <b>
        </td>
        <td align=right> 
            <br> "& Text(Value(Base,"en-US"),"[$-en-US]$#.00","en-US") &" 
            <br> "& Burden &"
            <br> "& Benefits &"
            <br><b> "& Text(Value(Total,"en-US"),"[$-en-US]$#.00","en-US") &"
        </td><b>
        <td align=center> <br><br><br><br><b>"& Laborers & " </td>
        <td align=right> <br><br><br><br><b>"& Text(Value(Subtotal,"en-US"),"[$-en-US]$#.00","en-US") & " </td>
        <td align=center> <br><br><br><br><b>"& Hours & " </td>

<td align=right> <br><br><br><br><b>"& Cost & " <b></td>","</tr><tr>") &"</table>"


OnSelect properties of PowerApp Button

 

 

Createfile.Run(HtmlLAB.HtmlText)


Flow titled "Createfile"

 

Capture.PNG

 

concat(...) flow expression

concat('<!DOCTYPE html>
<html>
<body>
<h2>Labor by Classification</h2>
<p> </p>

<table style="width:100%">
  <tr>
    <td>',triggerBody()['Createfile_FileName'] ,'</td>
  </tr>
</table>

</body>
</html>
')

Correctly Formatted HTML

HTML.PNG

 

 

Incorrectly Formatted PDF

PDF.PNG

 

 

2 REPLIES 2
Community Support Team
Community Support Team

Re: Powerapps HtmlText to PDF Conversion Flow - Formatting

Hi @Knich ,

Based on the screenshot that you provided, I think there is something issue with the configuration of your flow and the HTML content you passed from your app.

Firstly, within your flow, you need to specify the argument within the File Content field (rather than File Name field) of the "Create file" action to pass HTML content from your app as below:2.JPG

The HTML text content within your PowerApps should be modified as below:

"<table width='100%' border='1' cellpadding='5' style='border:1px solid black; border-collapse:collapse'>" &
     "<tr style='background-color:#efefef'>
         <th align=left></th> <th align=right> Cost </th> <th> # of Labors </th><th align=right> Subtotal </th><th> Hours </th><th align=right> TOTAL </th>
     </tr>" &
Concat(COlaborers,
        "<tr><td align='left'> 
            <b>"& Classification &"</b>
            <br> Base Pay 
            <br> Labor Burden
            <br> Benefits
            <br> <b>Total Hourly Rate <b>
        </td>
        <td align=right> 
            <br> "& Text(Value(Base,"en-US"),"[$-en-US]$#.00","en-US") &" 
            <br> "& Burden &"
            <br> "& Benefits &"
            <br><b> "& Text(Value(Total,"en-US"),"[$-en-US]$#.00","en-US") &"
        </td><b>
        <td align='center'> <br><br><br><br><b>"& Laborers & " </td>
        <td align='right'> <br><br><br><br><b>"& Text(Value(Subtotal,"en-US"),"[$-en-US]$#.00","en-US") & " </td>
        <td align='center'> <br><br><br><br><b>"& Hours & " </td>
        <td align='right'> <br><br><br><br><b>"& Cost & " <b></td></tr>") &"</table>"

Then modify your Concat(...) formula within your flow as below:

concat('<!DOCTYPE html>
<html>
<body>
<h2>Labor by Classification</h2>
<p>',
triggerBody()['Createfile_FileContent'],
'</p></body>
</html>'
)

3.JPG

Please check and see if the response within the following thread would help in youe scenario:

https://powerusers.microsoft.com/t5/Creating-Apps/HTML-Text-to-Flow-Convert-html-file-to-PDF/td-p/16...

Also please check and see the following video and blog would help in your scenario:

https://www.youtube.com/watch?v=IhE0-HumNNo&feature=youtu.be

 

If the issue still exists, I think the "Convert HTML to PDF" action of Muhimbi PDF connector could achieve your needs. Please check and see if the following blog would help in your scenario:

http://blog.muhimbi.com/2017/08/convert-powerapps-data-to-pdf.html

https://clavinfernandes.wordpress.com/2018/04/13/convert-powerapps-data-to-pdf-and-send/

within your flow, add a "Convert HTML to PDF" action of  Muhimbi PDF connector to convert your HTML content into a PDF file instead of the "Convert file" action of OneDrive for business connector. The flow's configuration as below:4.JPG

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TopShelf-MSFT
Level 10

Re: Powerapps HtmlText to PDF Conversion Flow - Formatting

Hi @Knich can you review the above reply and update the thread if it was helpful?

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,678)