Currently, I have a table that originates from a CSV file and has been converted to HTML using JavaRow in Talend before being sent via email. The code snippet used for this conversion is as follows:
componentcontext.MsgCode = "<br><br><style>table, td { word-wrap: keep-all; border: 1px solid black; border-collapse: collapse;}table, th { border: 1px solid black;}th, td {padding: 5px;},th {text-align: right;},th {background-color: #f2f2f2;},td{font-family: arial; font-size: 10pt;}</style> <table style=width:150px><tr> <th>column_A</th> <th>column_B</th> <th>column_C</th> <th>column_D</th>";
context.TableRow = "</td><td>"+input_row.column_A +"</td> <td>"+input_row.column_B +"</td> <td>"+input_row.column_C +"</td> <td>"+input_row.column_D+"</td> </tr>" + context.TableRow;
context.MsgCode = context.MsgCode + context.TableRow+ "</table>";
Although the current code successfully applies colors and structure to the table, there seems to be an issue with column sizes. The output obtained resembles the following image:
https://i.sstatic.net/9y7p0.png
I have attempted changing the width parameter to 100% in the style attribute, but it did not yield the desired result. Ideally, I want the table to appear like shown in the following image:
https://i.sstatic.net/Gzr1a.png
If anyone can provide guidance on how to achieve the correct column sizes in my table, I would greatly appreciate it.