Generate a PDF from Microsoft Automate Method – 2 Generate a PDF from Microsoft Automate Method – 2
Meet Bhimani

Meet Bhimani

July 12, 2022

All Post
blog-img

Table of Contents

Share:

Summary

In previous blog, we discussed Generating the PDF from Microsoft Flow with two approaches. The First one with an HTML Template can be accessed from here –link—

Let’s 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 is described below:

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 the following fields.

img-01

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 that  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 a Document Template in the Library. We would also 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 fieldswe would go to Library Settings > go to Advanced Setting > Edit Template. 

img-02

img-03

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. 

img-04

One created the template would look like this, 

img-05

Once created, save it in .docx format.  

So the 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 trigger – When an item is created of SharePoint connector. Select the Site collection address and List’s name. 

img-06

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

img-07

  • 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 the dynamic content window from the previous action 

img-08

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

img-09

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

img-10

  • Add an action – Create File for the 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. 

img-11

  • Add an action – Convert File for the SharePoint connector. Select the File as ID from the precious action. 

img-12

  • Add an action – Create File for the 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.  

img-13

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

img-14

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

img-15

The document that gets created in the Library named Test-PDF-Doc-Template while the Flow runs would appear like this: 

img-16

The document that would be created inside the Library Test-PDF-Documents after the Flow runs would appear as: 

img-17

The file content would look like this: 

img-18

Are you in need of assistance? We can help!

Book a live 1-on-1 call with the experts of Reality Tech to find out how we will help you to achieve your goal. You’ll find our solutions robust, scalable, and dependable. Let’s talk!

Please post your question, if you will find while implementing this process. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.