繁体   English   中英

将HTML表格导出到Excel工作表

[英]Export html table to excel sheet

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

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

 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>";    

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM