c# - C# 中的 HTML 表格格式不正确
问题描述
我正在使用 C# 在 .NET 中开发 API。我正在尝试以正确的格式发送电子邮件(当委派规则分配给特定用户时。)
这是迄今为止我尝试过的代码块。
strings.Add("email_delegation_rule_assigned", "Delegation rule assigned ");
strings.Add("email_delegation_rule_assigned_body",
"Hi {senderName},<br/><br/>"
+ "The following Workflow Request/s have been submitted for your approval, in the absence of {assignerUserName} from {delegateFromDate} to {delegateFromTo}.<br/><br/>"
+ "<style>table, th, td {border: 1px solid black; }</style>"
+ "<style>th {background-color:#73c1e1; }</style>"
+ "<table>" +
"<tr>" +
"<th> Delegation Req# </th>" +
"<th>Delegation<table><tr><td>From User</td><td>To User</td></tr></table></th>" +
"<th>Effective Period<table><tr><td> From </td><td> To </td></tr></table></th>" +
"<th> List of Workflows </th>" +
"</tr>" +
"<tr>" +
"<td>1</td>" +
"<td><table><tr><td> {assignerUserName} </td><td> You </td></tr></table></td>" +
"<td><table><tr><td>{delegateFromDate}</td><td>{delegateFromTo}</td></tr></table></td>" +
"<td>{workflowName}</td>" +
"</tr>" +
"</table><br/><br/>" +
"For further information please contact<br/><br/>" +
"You can view the Delegation details by clicking on the link below, using Flowdoh Workspace/Form Designer<br/><br/>" +
"Thank you!<br/>" +
"Warm Regards,<br/>" +
"Enadoc Team<br/><br/>"
);
我收到这种格式的电子邮件,这是错误的格式。
我的电子邮件应该是这样的......
将单列分为两列时如何正确对齐行?第th列与td值不一致。..我需要在表格中有单行。(忽略标题中的背景颜色)
请帮帮我。我非常感谢您的回复。提前谢谢你!
解决方案
所以 HTML 代码将是
<table border="1">
<tr>
<th scope="col" rowspan="2">Delegation Req#</th>
<th scope="col" colspan="2">Delegation</th>
<th scope="col" colspan="2">Effective Period</th>
<th scope="col" rowspan="2">List of workflows</th>
</tr>
<tr>
<td>From User</td>
<td>To User</td>
<td>From</td>
<td>To</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Admin</td>
<td>You</td>
<td>16/16/2020 18:30:00 PM (UTC)</td>
<td>17/16/2020 18:30:00 PM (UTC)</td>
<th scope="row">Workflow 06/15001</th>
</tr>
<tr>
<th scope="row">2</th>
<td>Admin1</td>
<td>You2</td>
<td>18/16/2020 18:30:00 PM (UTC)</td>
<td>19/16/2020 18:30:00 PM (UTC)</td>
<th scope="row">Workflow 06/15001</th>
</tr>
</table>
推荐阅读
- python - 尝试导入 Tkinter Canvas 时遇到“ModuleNotFoundError”?
- r - 从 R Shiny 中的单个 .txt 文件调用多个变量
- r - 预测.lm。具有非常数方差的误差模型的预测整数
- c# - 在 asp.net 5.0 web api 项目中访问中间件中的 TempData
- android - 如何在 zOrdered RTCView 之上显示普通视图组件
- android - Android React Native, page doesn't load when emulator debug mode is disabled
- safari - Safari Web Extension icon does not open popup from the overflow (>>) menu
- pine-script - Tradingview策略,当输入相反方向的订单时,许多订单正在退出
- c - 设置 X11 根窗口像素图
- opengl - gl_Position.z 在动画网格的片段着色器中使用时似乎不正确