Click here to Skip to main content
12,953,479 members (49,971 online)
Click here to Skip to main content
Add your own
alternative version


70 bookmarked
Posted 30 Jul 2005

DataSet to Excel in Two steps – with Different Styles

, 30 Jul 2005
Rate this:
Please Sign up or sign in to vote.
Cool Component exports DataSet(s) to Excel as Row-wise,Column-wise or Sheet-wise.

Sample Image - datasettoexcel.jpg


This component exports a DataSet to Microsoft Excel. You can also export more than one multiple DataSets at a time. This component handles disposing of Excel objects and cleaning up of memory automatically. So there is no worry of memory leakage!! Just two lines of code to export your DataSet to Excel. This is a free component.

Note: You need Excel to be installed in your system.

Different Styles

Different styles that are available are:

  • Row Wise: Exports each DataTable in the DataSet in row-wise in Excel.
  • Column Wise: Exports each DataTable in the DataSet in column-wise in Excel.
  • Sheet Wise: Exports each DataTable in the DataSet in one worksheet.

Other features and formatting styles

You can set the following:

  • HeaderForeColor
  • HeaderBackColor
  • ItemForeColor
  • ItemBackColor
  • ItemAlternateBackColor
  • FontStyle
  • RowsSpace
  • ColumnSpace
  • TableSpace

Sample Code

Utilities.ExcelExport.Export excel = 
                    new Utilities.ExcelExport.Export();
//Pass your Dataset and Specify the style.


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

United Arab Emirates United Arab Emirates
Software Engineer from India,Working in .NET for 2 years.

You may also be interested in...

Comments and Discussions

QuestionDifferent Style Pin
Member 125348396-Jul-16 16:19
memberMember 125348396-Jul-16 16:19 
GeneralMy vote of 4 Pin
Satyavir Yadav from New Delhi22-Apr-13 2:13
memberSatyavir Yadav from New Delhi22-Apr-13 2:13 
QuestionError on Line workbook = workbooks.Add(true); on Windows Server 2008 + IIS 7 Pin
keyur_parekh24-Oct-12 4:51
memberkeyur_parekh24-Oct-12 4:51 
QuestionThe Solution works great but.. Pin
Pooja H Borhade1-Nov-11 21:02
memberPooja H Borhade1-Nov-11 21:02 
AnswerRe: The Solution works great but.. Pin
Abdallah Al-Dalleh20-Jul-14 23:11
memberAbdallah Al-Dalleh20-Jul-14 23:11 
QuestionWell Done! Pin
Tadesse21-Jun-11 11:06
memberTadesse21-Jun-11 11:06 
GeneralMy vote of 1 Pin
navbingo2026-May-11 0:52
membernavbingo2026-May-11 0:52 
GeneralRe: My vote of 1 Pin
rama charan25-Jun-12 0:53
memberrama charan25-Jun-12 0:53 
QuestionErrors when compiling your source code in Visual Studio 2010 Pin
moiztankiwala10-Jun-10 10:29
membermoiztankiwala10-Jun-10 10:29 
AnswerRe: Errors when compiling your source code in Visual Studio 2010 Pin
Tadesse21-Jun-11 10:52
memberTadesse21-Jun-11 10:52 
Generalthank's!, works if Pin
cheluskis10-Sep-09 10:03
membercheluskis10-Sep-09 10:03 
Questionformulas Pin
SilentSage31-Dec-08 3:48
memberSilentSage31-Dec-08 3:48 
QuestionExcel Export Pin
drshreya18-Sep-08 9:02
memberdrshreya18-Sep-08 9:02 
GeneralYou are really the best Pin
minatharwat23-Jan-07 11:55
memberminatharwat23-Jan-07 11:55 
GeneralTakes ages .... Pin
oobject5-Sep-06 20:19
memberoobject5-Sep-06 20:19 
GeneralRe: Takes ages .... [modified] Pin
Tim Schwallie30-Jan-07 10:01
memberTim Schwallie30-Jan-07 10:01 
GeneralRe: Takes ages .... Pin
Tim Schwallie31-Jan-07 4:20
memberTim Schwallie31-Jan-07 4:20 
GeneralRe: Takes ages .... Pin
CikaPero28-Feb-10 21:27
memberCikaPero28-Feb-10 21:27 
QuestionApplication will not open but process does open Pin
Mariaelisau6-Jul-06 9:50
memberMariaelisau6-Jul-06 9:50 
GeneralSpecifing Excel File Name Pin
Ali Hussian Al-Faraj6-Jun-06 21:20
memberAli Hussian Al-Faraj6-Jun-06 21:20 
GeneralAssemblies missing Pin
lbispo4-May-06 5:30
memberlbispo4-May-06 5:30 
GeneralAccess Denied error Pin
srichikka2-May-06 23:01
membersrichikka2-May-06 23:01 
GeneralRe: Access Denied error Pin
Mukesh_B27-Aug-06 22:36
memberMukesh_B27-Aug-06 22:36 
GeneralAccess is denied. Pin
oneforall201228-Apr-06 8:53
memberoneforall201228-Apr-06 8:53 
QuestionWhere's the article? Pin
exhaulted21-Feb-06 23:03
memberexhaulted21-Feb-06 23:03 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 31 Jul 2005
Article Copyright 2005 by Krishna_accent
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid