I wanted to generate a Word Document that would display user information from the Dataverse. I wanted to display the results in a table, but the table would not take up the complete width of the Word Document so I wanted support for two columns.
To generate my report I created a flow, which I called Generate Users Side By Side Report Example
.
My flow consisted of the following:
- Manual Trigger
- Dataverse List Rows – Get the first 20 rows applying the filter
(firstname ne '#')
- Initialize Variable – Create an array based on the Users retrieved from the Dataverse
- Apply to each – Loop through each row in the Users table
- Append to array variable – Append the User information to the
users
array - Populate a Microsoft Word template – Pass the
users
array to Word template to populate - Create file – Create a new Word document so as to not overwrite the template
After a couple attempts, I finally figured it out.
In my Word document I clicked on Layout, then Columns and selected Two, for two columns.
This then shrunk my table to the appropriate size.
In my table I added several Plain Text Context Control to render the data.
I added a blank line after my table and then wrapped that all in a Repeating Section Content Control which I named users
to accept the User passed from the flow.
Looks great!
I wish I could print it from right to left, but seems like it only works down and across.
You can download the Word document at Users – Side By Side Report Example.docx and the Flow at GenerateUsersSideBySideReportExample_20230411150030.zip and try it out for yourself!
Discover more from Matt Ruma
Subscribe to get the latest posts sent to your email.