HTML表格在C#中格式不正确

问题描述 投票:0回答:2

我正在使用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/>"
                );

我正在以这种格式接收电子邮件,这是错误的格式。

enter image description here

我的电子邮件应该看起来像这样...

enter image description here

将单列分为两列时,如何正确对齐线? th

列与td值不对齐。..我需要在表中有一行。(忽略标题中的背景颜色)

请帮帮我。非常感谢您的回复。预先谢谢你!

我正在使用C#在.NET中开发API。我正在尝试以正确的格式发送电子邮件(当将委派规则分配给特定用户时。)这是到目前为止我尝试过的代码块。 ...

c# html .net visual-studio html-email
2个回答
0
投票

您需要使用colspan和rowspan属性而不是单独的表进行布局。这是一个例子


0
投票

似乎您需要这个。 enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.