One way is to modify the html_content attribute value inline after it exits the HTMLReportGenerator. What I tend to do is create an HTML template with all of my CSS and JavaScript, then extract only the table html elements from the html_content and then plug those values into the template html. That way you have your styling with the content created from the HTMLReportGenerator and can send that to the emailer, or HTMLWriter transformer, depending on the logic.
You can enter custom html in the HTMLReporter, just select that option type for the html section you want to define:
Keep in mind that a lot of email clients are very reluctant to use external css files for HTML styling so you'll need to do that inline, like @Chris Warren suggests.
Thank you all for the custom HTML advice.
Just another quick question re: data formatting. Below is my insert into the log table which looks fine:However, the HTML e-mail notification shows decimal place under WO # and Date squeezes together:
How can I modify formatting for those data types in HTMLReportGenerator? Thanks.
use date time converter transformer
My current solution for improving the layout of tables that are being sent to recipients using MS Outlook is to place a StringReplacer downstream of the HTMLReportGenerator and configure the StringReplacer to insert style properties into the HTML that defines the table in a way that Outlook interprets. Details are below:
Here is the HTML to copy/paste into the "Replacement Text" parameter:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding-left: 10px;
padding-right: 10px;
}
</style>
</head>
Here's a screenshot of the configured StringReplacer transformer:
Here is the summary Annotation that displays all of the parameter configurations:
StringReplacer_2 AStringReplacer]
General:
Attributes: html_content
Mode: Replace Text
Case Sensitive: No
Text To Replace: </head>
Replacement Text:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding-left: 10px;
padding-right: 10px;
}
</style>
</head>
If Attribute Value Does Not Contain Text:
Set Attribute Value To: <Do Nothing>
My current solution for improving the layout of tables that are being sent to recipients using MS Outlook is to place a StringReplacer downstream of the HTMLReportGenerator and configure the StringReplacer to insert style properties into the HTML that defines the table in a way that Outlook interprets. Details are below:
Here is the HTML to copy/paste into the "Replacement Text" parameter:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding-left: 10px;
padding-right: 10px;
}
</style>
</head>
Here's a screenshot of the configured StringReplacer transformer:
Here is the summary Annotation that displays all of the parameter configurations:
StringReplacer_2 AStringReplacer]
General:
Attributes: html_content
Mode: Replace Text
Case Sensitive: No
Text To Replace: </head>
Replacement Text:
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding-left: 10px;
padding-right: 10px;
}
</style>
</head>
If Attribute Value Does Not Contain Text:
Set Attribute Value To: <Do Nothing>
Hi @joshuadamron ,
I just wanted to write and say I really appreciated your info on using the StringReplacer and the HTML content in the email looks so much better than what is generated right out of the HTMLReportGenerator.
I was hoping you might have some insight. I would really love the table records to have the zebra striping. I have tried two things and neither are producing the stripes. In the HTMLReportGenerator I have tried selecting Table Style 'Striped' and in the preview within that transformer the table record shows striped, but this isn't the case for the end email with the HTML content.
I have also tried adding to the HTML in the StringReplacer below. Do you have any idea or thoughts why the striped pattern is not working?
Thanks in advance!
Kathy
<style>
table,th, td {
border: 1px solid gray;
border-collapse: collapse;
}
th, td {
padding-left: 10px;
padding-right: 10px;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
</head>