Click here to Skip to main content
6,595,854 members and growing! (16,773 online)
Email Password   helpLost your password?
Enterprise Systems » Office Development » Microsoft Excel     Intermediate

DataSet to Excel in Two steps – with Different Styles

By Krishna_accent

Cool Component exports DataSet(s) to Excel as Row-wise,Column-wise or Sheet-wise.
C#.NET 1.1, Win2K, WinXP, ADO.NET, VS.NET2003, Dev
Posted:30 Jul 2005
Views:82,570
Bookmarked:49 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
23 votes for this article.
Popularity: 4.31 Rating: 3.16 out of 5
7 votes, 30.4%
1

2

3
5 votes, 21.7%
4
11 votes, 47.8%
5

Sample Image - datasettoexcel.jpg

Introduction

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.

excel.ExportDataToExcel(yourDataSet, 
            Utilities.ExcelExport.ExportStyle.RowWise);

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

Krishna_accent


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

Other popular Office Development articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 20 of 20 (Total in Forum: 20) (Refresh)FirstPrevNext
Generalthank's!, works if Pinmembercheluskis11:03 10 Sep '09  
Questionformulas PinmemberSilentSage4:48 31 Dec '08  
QuestionExcel Export Pinmemberdrshreya10:02 18 Sep '08  
GeneralYou are really the best Pinmemberminatharwat12:55 23 Jan '07  
GeneralTakes ages .... Pinmemberoobject21:19 5 Sep '06  
GeneralRe: Takes ages .... [modified] PinmemberTim Schwallie11:01 30 Jan '07  
GeneralRe: Takes ages .... PinmemberTim Schwallie5:20 31 Jan '07  
QuestionApplication will not open but process does open PinmemberMariaelisau10:50 6 Jul '06  
GeneralSpecifing Excel File Name PinmemberAli Hussian Al-Faraj22:20 6 Jun '06  
GeneralAssemblies missing Pinmemberlbispo6:30 4 May '06  
GeneralAccess Denied error Pinmembersrichikka0:01 3 May '06  
GeneralRe: Access Denied error PinmemberMukesh_B23:36 27 Aug '06  
GeneralAccess is denied. Pinmemberoneforall20129:53 28 Apr '06  
GeneralWhere's the article? Pinmemberexhaulted0:03 22 Feb '06  
GeneralAccess is denied PinmemberL. Des Lierres9:01 21 Feb '06  
GeneralRe: Access is denied PinmemberL. Des Lierres15:08 28 Feb '06  
GeneralRe: Access is denied PinmemberL. Des Lierres9:28 29 Jun '06  
GeneralRe: Access is denied PinmemberL. Des Lierres9:29 29 Jun '06  
GeneralThis article is excellent PinmemberTigger9917:39 7 Feb '06  
GeneralExporting Russian Characters to a CSV File PinmemberMSJ_PK20:27 2 Aug '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 30 Jul 2005
Editor: Smitha Vijayan
Copyright 2005 by Krishna_accent
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project