簡體   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