I followed the directions in this video to export a SharePoint List first to an HTML file, and then use that to create a PDF file. The PowerAutomate ‘flow’ is shown in the image below.
Although this works, I want to be able to format the HTML table. As it currently is, the table has no visible borders, and the column widths are not appropriate.
So…Is there a way I can insert something like this into the flow for the beginning of the HTML file, to provide visible borders?
<html><head><style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
table style="width:100%";
}
</style></head><body>
Or, in the first row () of the table, change this <th>Minutes</th>
to this: <th style="width:50%">Minutes</th>
, to set the column width?
If there’s another, better way to export the SharePoint List into a PDF I’d love to hear it; I’m doing it via an HTML file because that’s what I’ve been able to find.
I’m not overly fond of supposedly ‘low-code’ PowerAutomate so maybe there are better ways? I’m not familiar with SharePlum but maybe Python is a better approach?
2
Answers
Thanks to Expiscornovus for the link, which helped me figure out how to introduce the initial HTML code I wanted to show borders, etc. If anyone sees this and wants details of what I did...
Basically I initialised a variable (string) and input the HTML code I wanted as the 'value'.
For my second question, how to change the HTML code generated from the Sharepoint List (in my case, to specify column width), I found the video on this page helpful. What I did was initialise another variable, but here I used the 'replace' expression to substitute
replace(body('Create_HTML_table'),'<th>Minutes</th>','<th style="width:50%">Minutes</th>')
. The 2 newly interpolated steps are shown below:For Power Automate HTML table styling my go-to article is this one from Ryan Maclean: https://ryanmaclean365.com/2020/01/29/power-automate-html-table-styling/
Have a look at that Injecting CSS Styling section of that blog.
Probably not every style will carry over to a PDF when converting the file from HTML to Pdf format. That is something you will have to test yourself.