格式化 HTML table 以使用 Talend 通过电子邮件发送?
Format HTML table to send by email using Talend?
我有一个来自 CSV 的 table,它由 HTML 转换并使用 Talend 通过电子邮件发送。要将 CSV 构建为 HTML,我使用的是 JavaRow:
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>";
通过这段代码,我得到了我想要的颜色和结构,但是列的大小变得非常糟糕。例如,我得到以下输出:
我必须在我的代码中添加什么才能获得具有正确列大小的 table?我已经将 style=width 更改为 100%,但没有任何好的结果。我想要以下输出:
谁能帮帮我?
在我的一项工作中,我们这样解决了它:(在 Outlook 上工作得很好,但不确定其他工具)。
整个内容包裹在一个 table 中,如下所示:
<tr>
<td width="660">
<div style="width:100%; margin:0 auto; text-align: center;">
<font color="#1E4191" style="font-size:30px;">
<strong>Data Load Report</strong>
</font>
</div>
<br><br>
<table><tr bgcolor="#F3E2A9"><td bgcolor="#F3E2A9"><font color="#1E4191" >Hello</font></td>
等等
</font></td></tr></table>
<br>
<font color="#1E4191" face="Arial">
Kind Regards, <br>
<strong>Talend Team</strong>
</font>
</td>
</tr>
</table>
是的,我们需要为每个单元格定义字体类型和颜色:(
这在 outlook 中非常有效,如果 table 不适合预定义的 660px 宽度,则会被分成多行。
我有一个来自 CSV 的 table,它由 HTML 转换并使用 Talend 通过电子邮件发送。要将 CSV 构建为 HTML,我使用的是 JavaRow:
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>";
通过这段代码,我得到了我想要的颜色和结构,但是列的大小变得非常糟糕。例如,我得到以下输出:
我必须在我的代码中添加什么才能获得具有正确列大小的 table?我已经将 style=width 更改为 100%,但没有任何好的结果。我想要以下输出:
谁能帮帮我?
在我的一项工作中,我们这样解决了它:(在 Outlook 上工作得很好,但不确定其他工具)。
整个内容包裹在一个 table 中,如下所示:
<tr>
<td width="660">
<div style="width:100%; margin:0 auto; text-align: center;">
<font color="#1E4191" style="font-size:30px;">
<strong>Data Load Report</strong>
</font>
</div>
<br><br>
<table><tr bgcolor="#F3E2A9"><td bgcolor="#F3E2A9"><font color="#1E4191" >Hello</font></td>
等等
</font></td></tr></table>
<br>
<font color="#1E4191" face="Arial">
Kind Regards, <br>
<strong>Talend Team</strong>
</font>
</td>
</tr>
</table>
是的,我们需要为每个单元格定义字体类型和颜色:(
这在 outlook 中非常有效,如果 table 不适合预定义的 660px 宽度,则会被分成多行。