cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RTW
Level: Powered On

HTML Table Colours to PDF

Hi everyone. I'm working on a project for my office's weekly newsletter. Basically, the user selects news stories and statistics from either SharePoint lists or direct user input. The PowerApp takes the user input and creates an HTML text field as a preview. Once the user is happy with the layout, they trigger a flow which creates the actual document.

Currently, I want to have this send out via a PDF. I found a flow online that creates an HTML document, converts it to PDF and deletes the HTML document. This aspect of the flow works. What doesn't seem to work is some of the formatting on the table - specifically colours.

 

For example, I ran this sample table from w3schools through my proces:

 

 

 

<!DOCTYPE html>
<html>
<head>
<style>
table {
  width:100%;
}
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
th, td {
  padding: 15px;
  text-align: left;
}
table#t01 tr:nth-child(even) {
  background-color: #eee;
}
table#t01 tr:nth-child(odd) {
 background-color: #fff;
}
table#t01 th {
  background-color: black;
  color: white;
}
</style>
</head>
<body>

<h2>Styling Tables</h2>

<table>
  <tr>
    <th>Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>
    <td>80</td>
  </tr>
</table>
<br>

<table id="t01">
  <tr>
    <th>Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>
    <td>80</td>
  </tr>
</table>

</body>
</html>

 

 

Here is a screenshot of the HTML document VS the generated PDF.

 

image.png


Does anyone know how I can get the table background colours to translate into the PDF? I'm not too familiar with HTML/CSS so I'm at a loss.  Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
RTW
Level: Powered On

Re: HTML Table Colours to PDF

@Gristy - I am using the "Convert File Using Path" action under the OneDrive for Business connector. I know that Plumsail is pretty powerful but I want to proof it out before I need to acquire additional licensing.

@Jay-Encodian I'll check that out as well moving forward.

That being said, I seem to have (more or less) fixed the issue. I had to add the style elements to each table cell instead of using CSS. I just adjusted the formulas that concatenated the data into tables and it worked as expected. Its not perfect but its enough to get me up and running and maybe get things approved for more.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: HTML Table Colours to PDF

which html to pdf converter are you using? try the plumsail one its quite good

Super User
Super User

Re: HTML Table Colours to PDF

@RTW 

The Encodian 'Convert HTML to PDF' connector will work for you as well - https://support.encodian.com/hc/en-gb/articles/360022205154-Convert-HTML-to-PDF

 

An example (and very simple) Flow configuration:

 

screen2.png

 

You can either convert a file, a URL or just add the HTML which you can also interlace directly with dynamic Flow data!

 

screen3.png

 

Example output below:

 

screen1.png

 

The Encodian action also provides some useful configuration options where tables span multiple pages, check out the 'Repeat Table Header' and 'Repeat Table Footer' advanced options. 

 

HTH

Jay

RTW
Level: Powered On

Re: HTML Table Colours to PDF

@Gristy - I am using the "Convert File Using Path" action under the OneDrive for Business connector. I know that Plumsail is pretty powerful but I want to proof it out before I need to acquire additional licensing.

@Jay-Encodian I'll check that out as well moving forward.

That being said, I seem to have (more or less) fixed the issue. I had to add the style elements to each table cell instead of using CSS. I just adjusted the formulas that concatenated the data into tables and it worked as expected. Its not perfect but its enough to get me up and running and maybe get things approved for more.

View solution in original post

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,125)