将html表导出为ex​​cel表

时间:2014-03-04 08:34:28

标签: c# html

我有一个应用程序可以创建并向我的团队发送电子邮件。我根据特定条件动态创建HTML表。然后我使用Outlook HTMLBody方法发送我的电子邮件。电子邮件工作正常。

用户现在已经询问我是否可以在电子邮件中创建一个html链接,该链接将打开显示相同数据的Excel文件。我的问题是有一个快速或简单的方法来复制我直接使用我的电子邮件excel的html表吗?

 string htmlHeader = "<table style='font-size: 12pt;'><tr><th align='left'>Sedol</th><th>&nbsp;</th>" +
            "<th align='left'>Name</th><th>&nbsp;</th>"+
            "<th align='left'>Ex Date</th><th>&nbsp;</th>" +
            "<th align='left'>Div Type</th><th>&nbsp;</th>" + 
            "<th align='left'>Div Contribution</th><th>&nbsp;</th>" + 
            "<th align='left'>Div Value GBP (p)</th><th>&nbsp;</th>" +
            "<th align='left'>Nominals</th><th>&nbsp;</th>" +
            "<th align='left'>Currency</th><th>&nbsp;</th>" + 
            "<th align='left'>Country of Incorp</th><th>&nbsp;</th></tr>";    

2 个答案:

答案 0 :(得分:0)

您可以查看此链接以获取格式提示:http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx

您可以添加标签,您的html应该或多或少地运作。文件扩展名可能是.xlsx

答案 1 :(得分:0)

由于用户要求显示在Excel电子表格中,您可以创建CSV文件。