Click here to Skip to main content
15,606,617 members
Articles / Web Development / HTML
Posted 8 Dec 2005


18 bookmarked

Export 2 Excel In .Net

Rate me:
Please Sign up or sign in to vote.
1.08/5 (16 votes)
8 Dec 20051 min read
Export 2 Excel

Download sourcecode

This source used for Exporting data into To Excel ..
Just give referance and change few things .u get the result.
This one useful to both and
Just sending parameters to procedure like datatable,filename ,filepath,column names.
Its creates the excel file data export into excel file and save into ur target folder.

  ' step 1: unzip the file
' step 2: copy the dll file into ur aplliction bin folder
' step 3: Give refernce to this .dll
' step 4: copy below code and paste into ur program, where u need this and do some modifications directory, filename..

        Dim dad As New SqlClient.SqlDataAdapter("select * from authors", "server=localhost;user id=sa;password=;Initial catalog=pubs;")
 Dim ds As New DataSet
        Dim obj As New Hari_Export2Excel.NameSpace_Export2Excel.Class_Export2Excel
        Dim filepath As String = "C:\TargetDirectory\" 'or server.mappath("../outputdirectory/")
        Dim filename As String = "abc.xls"

        '' Sending Header Column Names
        'Dim col() As String = {"COLUMN ONE", "COLUMN TWO", "COLUMN THREE"}
        'obj.Export2Excel_By_Srihari(filename, filepath, ds.Tables(0),  col)

        ' Default Column Names from database
        obj.Export2Excel_By_Srihari(filename, filepath, ds.Tables(0), Nothing)

        ' Accessing File from saved Path
        'Response.Redirect(filepath & filename)






This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Written By
Web Developer
Malaysia Malaysia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralCreate nicely formatted Excel files Pin
aron.sinoai22-Apr-11 9:56
aron.sinoai22-Apr-11 9:56 
Generalneed help Pin
NHadizadeh25-Mar-09 19:12
NHadizadeh25-Mar-09 19:12 
GeneralAlternative import/export Pin
FilipKrnjic15-May-08 21:44
FilipKrnjic15-May-08 21:44 
GeneralobjCells not declared Pin
cookie king6-May-08 10:55
cookie king6-May-08 10:55 
GeneralHi need help ! Pin
Jagdish aher24-Sep-07 0:15
Jagdish aher24-Sep-07 0:15 
GeneralRe: Hi need help ! Pin
hari_ksa24-Sep-07 19:33
hari_ksa24-Sep-07 19:33 
GeneralBasically a CSV Export. Why not SpreadsheetML Pin
CARPETBURNER8-Dec-05 22:23
CARPETBURNER8-Dec-05 22:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.