Click here to Skip to main content
Licence 
First Posted 8 Dec 2005
Views 62,262
Bookmarked 18 times

Export 2 Excel In .Net

By | 8 Dec 2005 | Article
Export 2 Excel

Download sourcecode
Introduction

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 asp.net and vb.net.
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"
        dad.Fill(ds)

        '' 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)

 

 

 

 

License

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

About the Author

hari_ksa

Web Developer

Malaysia Malaysia

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCreate nicely formatted Excel files [modified] Pinmemberaron.sinoai9:56 22 Apr '11  
Generalneed help PinmemberNHadizadeh19:12 25 Mar '09  
GeneralAlternative import/export PinmemberBarbaMariolino21:44 15 May '08  
GeneralobjCells not declared Pinmembercookie king10:55 6 May '08  
GeneralHi need help ! PinmemberJagdish aher0:15 24 Sep '07  
GeneralRe: Hi need help ! Pinmemberhari_ksa19:33 24 Sep '07  
GeneralBasically a CSV Export. Why not SpreadsheetML PinmemberJohn Crocker22:23 8 Dec '05  

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

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 9 Dec 2005
Article Copyright 2005 by hari_ksa
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid