okalinic
(Okalinic)
February 6, 2025, 10:49am
1
Dear, I need your assistance.
I need the values in one column of an HTML table to be checked, and the cells should be highlighted based on the following conditions:
Values less than 9999 should be marked in red.
Values between 10,000 and 15,000 should be marked in yellow.
This table will be sent as the body of an email.
@okalinic ,
Refer this code.
Input file:
Output Email:
Code Snippet:
Code to change color as per value:
If(CDbl(CurrentRow.Item("column Name").ToString) < 10000,"<td style=""color: red;"">","<td>")+CurrentRow.Item(6).ToString+"</td></tr>"
Full Code developed on Studio version 2025.0.157:
SendHTMLBodyEmail.zip (198.8 KB)
Hi @okalinic
If the input is in html format i.e table, then follow this
Download the package"UiPathTeam.ExtractDataTablesFromHTML.Activities"
"<table border=2><tr><td>" +
String.Join("</td><td>", tablearray(0).Columns.Cast(Of DataColumn).Select(Function(x) x.ColumnName).ToArray) +
"</td></tr>" +
String.Join("</tr><tr>",
(From x In tablearray(0).AsEnumerable
Select "<tr>" +
String.Join("", x.ItemArray.Select(Function(cell, index) If(tablearray(0).Columns(index).ColumnName = "Values" AndAlso CDbl(x("Values").ToString) < 9999,
"<td style=""color: red;"">" + cell.ToString() + "</td>",
If(tablearray(0).Columns(index).ColumnName = "Values" AndAlso CDbl(x("Values").ToString)< 10000 AndAlso CDbl(x("Values").ToString) < 15000,
"<td style=""color: red;"">" + cell.ToString() + "</td>",
"<td>" + cell.ToString() + "</td>"))
).ToArray) + "</tr>"
).ToArray) +
"</table>"
Demo output!
Hope this helps