如何使用c#中的数据创建动态表并将其附加到邮件正文? [英] How to create a dynamic table with data in c# and append it to the mail body?
本文介绍了如何使用c#中的数据创建动态表并将其附加到邮件正文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用c#中的数据创建动态表并将其附加到邮件正文?
How to create a dynamic table with data in c# and append it to the mail body?
推荐答案
虽然这不是问题,但您可以参考这个: http://stackoverflow.com/questions/11121908/send-email-with-a -table-inside [ ^ ]
Though this is not a question,you can refer this one : http://stackoverflow.com/questions/11121908/send-email-with-a-table-inside[^]
只需创建StringBuilder
,从而创建HTML
表格。循环遍历DataTable
的行,并在< td>内分配单元格值。标签。
循环StringBuilder
将包含整个表。然后只需在邮件中发送HTML
。
Just create aStringBuilder
thereby creating aHTML
table with that. Loop through the rows of theDataTable
and assign cell values inside the <td> Tag.
After the loopStringBuilder
would contain the whole table. Then just send thatHTML
in mail.
这篇关于如何使用c#中的数据创建动态表并将其附加到邮件正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文