In an early blog I showcased an awesome solution to display PDF documents stored in a SharePoint Document library in Power Apps using an extraordinarily simple flow. In this blog I will show you how you can view Word documents, PowerPoint presentations and HTML files in Power Apps leveraging the PDF Viewer control with nothing more than a single expression / formula on the Document property of the control.
I haven’t extensively tested all other possible file types however I did test with Excel workbook and Text files and this solution does not work with those file types.
And now the Solution
In the demo app showcased (and shared later in this blog) I added a Data source connection to a SharePoint Document library containing several Word documents, PowerPoint presentations and HTML files.
Power App Home Screen Controls
In the Power App I added a Gallery control and a PDF Viewer control to the home / landing screen in the app.
On the Gallery control I set the Items property to the SharePoint Document library Data Source connection and added a few fields to display basic infomation related to each file in the library.
PDF Viewer Control
This is where all the awesomeness happens. All you need to do is set the Document property on the PDF Viewer as follows:
Substitute( Home_DocumentLibrary_Gallery.Selected.Thumbnail.Small; "transform/thumbnail"; "transform/pdf" )
Well I did say this was as simple as it gets so no point in waffling any further. By all means test drive the demo app and marvel at the awesomeness ?.
Download the app from the GitHub repository. Import it into your own environment. Remove the existing Data source connection and add a new Data source connection to one of your own Document libraries in SharePoint. Update the Items property on the Gallery control and set it the the Data source connection you’ve added. That’s it, you’re done.