If you want to print in PowerApps, we’ve found a way. Here it is.
One of the biggest roadblocks for users converting from InfoPath to PowerApps has been the lack of any printing support in PowerApps.
While I believe the support is in the pipeline for PowerApps, it is possible to create “Printable Forms” in PowerApps today!
Path to Printing in PowerApps
So, I have a simple two-screen option for a PowerApp I built, and I want users to be able to print the form after it has been submitted.
Here is what my form looks like:
It’s a pretty standard form for a badge request. So now, how do we get it to print? The answer lies with HTML and Microsoft Flow.
My first step is to add a ‘Print Form’ button on the first item in my requests gallery.
I used a simple Icon for my button. (Make sure you insert it into this box, so the icon ties itself to each item in the gallery)
Next, you will need to generate a printable view of your form from HTML. You can use any HTML tool to do this (you can even copy and paste the HTML code from InfoPath, if you are migrating a form and had a printable view in there).
For this example, I created a simple two-column HTML table, and replaced the first column with all of my display names for my form. We will add the values for the right column in the next step.
Back in your PowerApp, Insert an HTML text input box into the first item of your gallery, and change the visible property to false.
For the HTML text property, copy and paste your HTML code between the “” (Note: If your HTML code uses double quotes, do a find and replace. Make sure to replace double quotes with single quotes).
We can now insert the values of the form into the second column.
<td style=’width: 230px;’><strong>Request Type</strong></td>
Notice, I am coming out of the closed quotes, and then appending the current items’ Request Type Value, and then appending the other HTML again.
Now, I have my HTML form, which has all of my values.
Next I will create a flow for this icon, by selecting the icon and clicking the ‘Flows’ button on the top toolbar.
I will create a “New Flow” for this button.
I have named my button “Send Printable Form” and I will send the HTML in an email.
Add the Outlook 365 “Send an Email” action, and fill out the settings.
The two most important things here are to make sure you use the “Ask in PowerApps” for the body, and change the “Is HTML” to “Yes.”
Click “Create Flow”, and switch back to your PowerApp.
Then, click the “New Flow” you just created to assign it to that button:
In the formula bar, pass any of the variables you defined in Flow.
In my case, I will be sending the “First Name” (which will be added to the subject), and HTMLText2.HTMLText (which is my HTML text box, and the HTML text property of that box).
Now just preview the app, and click your print button. You (or whomever was in the “To:” field of your Flow), will receive an email with a filled out form that you can print!
(NOTE: Because this is HTML, you can customize the look and feel as much as you want.)
If you hate printing out of your email client, this is for you…
You can also take that HTML content and just add it to an HTML file! In my case, I saved all of the content to an HTML file in my One Drive For Business by adding an extra step to the Flow:
Now when the flow runs, I can simply download and open the HTML file from my browser and print it from there:
I hope this is something you may find useful, especially if you have a strong need to print. Don’t miss the rest of the series for more tips!
Part three of a series.