Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<table id="tblsalary">
<tr style="background-color: #2291FF;">
        <td align="left" class="salarytable1">

        Basic Salary</td>
        <td align="left" class="salarytable2" style="font-weight: bold">
            <asp:Label ID="lblBasic" runat="server" Text="Label"></asp:Label>
            </td>
         <td align="left" class="salarytable1">
        PF Employee Contribution</td>
        <td align="left" class="salarytable2" style="font-weight: bold">
            <asp:Label ID="lblPFcontribution" runat="server" Text="Label"></asp:Label>
            </td>
        </tr></table>



VB
Protected Sub btndownload_Click(sender As Object, e As EventArgs) Handles btndownload.Click
    Dim excel As GridExcelExport = New GridExcelExport(Me.tblsalary, "Salary Slip.xls")
    excel.ExportNestedTable = True
    excel.Export()
End Sub
Posted
Updated 3-Sep-15 2:54am
v3
Comments
Maciej Los 3-Sep-15 8:55am    
We need a definition of GridExcelExport class!

1 solution

  1. Export data used to populate your table, not ASP.NET or HTML controls.
  2. You can use Open XML SDK. Please see this CodeProject article for the example of using it: Creating basic Excel workbook with Open XML[^].

    See also my past answers referenced in this one: How to add microsoft excel 15.0 object library from Add Reference in MS Visual Studio 2010[^].

    By the way, these Microsoft articles explain why using Office interop in server setting is not recommended:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2[^],
    http://support.microsoft.com/kb/257757/en-us[^].


Good luck.
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900