Generate a PDF using PowerAutomate Method – 2

In previous blog, we discussed about Generating the PDF from Microsoft Flow with 2 approaches. The First one with HTML Template can be accessed from here Generate a PDF using PowerAutomate Method – 1

Lets start with the Second approach,

Part-2
Generate a PDF of SharePoint List Data with Word Template from Microsoft Flow

This is the second approach for generating the PDF from SharePoint List data that is using the predefined format as Template in SharePoint Document Library, then updated the file properties and created a template in OneDrive then converting that template to PDF and saving in SharePoint Document Library.

The approach goes like,

Step-1

Create a SharePoint Custom List named Conversion-to-PDF-from-Flow with necessary fields to enter the data, required to move to predefined PDF Format. Here I have taken following fields.

Create another SharePoint Document Library with name Test-PDF-Documents to store the generated PDF’s.

Please note, while creating multi-line columns, make sure the plain text is selected.

Step-2

The Word Template

Create a SharePoint Document Library named Test-PDF-Doc-Template. Create the same data fields created in the SharePoint List – Conversion-to-PDF-from-Flow.

We would create document template in the Library. We would create the same data fields in the library as we had created in the List named Conversion-to-PDF-from-Flow. Once we have created the same data fields, we would go to Library Settings > go to Advanced Setting > Edit Template.

In previous approach, we used tokens. In this approach we would be using the quick parts from Insert tab. We can access or add them like Insert > Quick Parts > Document Property > Use the data column which would be used to replace the data inserted in it.

One created the template would look like this,

Once created, save it in .docx format.

So next time when you would try to edit the template it would have to be saved in .docx format.

Step-3

Creating the flow

  • Create the Flow with the trigger – When an item is created of SharePoint connector. Select the Site collection address and List’s name.

Add an action – Get File Content of SharePoint connector. Select the Site collection address and the File from which the template would be taken and used to create the file.

  • Add an action – Create File of SharePoint connector. Select the Site collection address, folder path to the template saved, Create a File name as required and select the file content from dynamic content window from the previous action.
  • Add an action – Update File Properties, select the Site collection address, Library name, Select the ID as ItemID from previous action Create File action and select the data fields linked to each other.
  • Add an action – Get File Content of SharePoint connector. Select the Site Collection address, and the file identifier, set the file identifier as file identifier from the previous action.
  • Add an action – Create File of OneDrive connector. Select the Folder path to save the file, name of the file and the file content as file content from previous action from dynamic content.
  • Add an action – Convert File of SharePoint connector. Select the File as ID from the precious action.
  • Add an action – Create File of SharePoint connector. Select the Site collection address, folder path to save the file, name of the file with an extension .pdf and file content as File Content from previous action of Convert File.

Once the Flow is created, it would look like this,

Let’s enter data in our SharePoint Custom List Conversion to PDF from Flow,

The document that gets created in Library named Test-PDF-Doc-Template while the Flow runs would come up as,

The document that would be created inside the Library Test-PDF-Documents after the Flow runs would come up as,

The file content would come up like this,

Part – 1 Expand-Collapse rows in PowerApps Canvas App Gallery

I

n this blog post, I have shown the steps for creating the expand-collapse gallery control in Canvas App.

Now, let’s start building the gallery, for which we would have to create out list first and have the same loaded in a PowerApps App as a data source.

Step 1 – Create “Expand-Collapse Control” list with the following columns and their types.

Step 2 – Add entries in “Expand-Collapse Control” list

Step 3 – Create canvas app and name it “Expand-Collapse App”

  1. Add a new Blank screen
  2. From the controls section on the top in Insert tab, add a “Blank flexible height” gallery which would be our Parent Gallery
  3. And add a “Blank vertical” gallery in “Blank flexible height” gallery – which would be our Child Gallery
  • Parent Gallery
  • Child Gallery

Step 4 – Adding the data source to Gallery

In Parent Gallery add “Expand – Collapse Control” list data

For Child Gallery in “items” property add code – ThisItem

Step 5 – Add labels according list’s columns and add show data

Step 6 – Add code on all label’s “visible” property which are added in “Child Gallery”. Also, to have the Child Gallery show when button is clicked, we have to add code in Child Gallery’s on “Visible” property

“Visible” property – Switch(varShowId,0,false,ThisItem.ID,true)

Step 7 – Add down arrow icon and up arrow icon.

Then first write code on down arrow icon(Down arrow icon) it’s “OnSelect” property – If(varShowId=ThisItem.ID,Set(varShowId,0),Set(varShowId,ThisItem.ID))

And add code on visible property – If(Up arrow icon.Visible=true,false,true)

Step 8 – On  the down arrow icon and write code on it’s “OnSelect” property – If(varShowId=ThisItem.ID,Set(varShowId,0),Set(varShowId,ThisItem.ID))

And write code on it’s “Visible” property – Switch(varShowId,0,false,ThisItem.ID,true)

That’s all,

We have finally created the collapsible Gallery control in Power App.

Hope this helps!!

 

Thank you,
Jaydeep Patel