Search code examples
htmlpdfpower-automatesharepoint-list

How to format HTML that's generated from a SharePoint List


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?

enter image description here


Solution

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