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.
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!
Solved! Go to Solution.
@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.
which html to pdf converter are you using? try the plumsail one its quite good
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:
You can either convert a file, a URL or just add the HTML which you can also interlace directly with dynamic Flow data!
Example output below:
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
@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.
@Kmayes - Basically I had to do it all without CSS - manually set the colours and what not as needed.
Hi @Jay-Encodian!
I work with 'Convert HTML to PDF' connector but I have a problem, I need to set a background color in a columns of table, but the document keeps turning everything blank, could you help me please?
I use this code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<style type='text/css'>
#campo1 {background-color: RGBA(162, 215, 236, 90%);border: 1px solid black;}
</style>
</head>
I also try with:
<td id='campo1' style='background-color: RGBA(162, 215, 236, 90%);'><b>1</b> Hi world <td>
Regards
JA
@Jesus_Aguirre Hey, please email support@encodian.com and the team will advise... I'll then update this thread with the resolution
Cheers J
Hi @Jay-Encodian I solved the problem by implementing this: #campo1 {background-color: RGBA(162, 215, 236, .9);border: 1px solid black;}
I changed the percentage to the decimal.
Thanks and regards.
JA
User | Count |
---|---|
26 | |
13 | |
11 | |
9 | |
8 |
User | Count |
---|---|
49 | |
27 | |
23 | |
20 | |
19 |