如何使用c#中的数据创建动态表并将其附加到邮件正文? [英] How to create a dynamic table with data in c# and append it to the mail body?

查看:124
本文介绍了如何使用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 a StringBuilder thereby creating a HTML table with that. Loop through the rows of the DataTable and assign cell values inside the <td> Tag.

After the loop StringBuilder would contain the whole table. Then just send that HTML in mail.


这篇关于如何使用c#中的数据创建动态表并将其附加到邮件正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆