Click here to Skip to main content
5,788,212 members and growing! (19,088 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, Windows, .NET, ADO.NET, Visual Studio, VS.NET2003, Dev

Posted: 30 Jul 2005
Updated: 30 Jul 2005
Views: 64,808
Bookmarked: 43 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
19 votes for this Article.
Popularity: 3.68 Rating: 2.88 out of 5
7 votes, 36.8%
1
0 votes, 0.0%
2
0 votes, 0.0%
3
5 votes, 26.3%
4
7 votes, 36.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


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

Other popular Office Development articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 19 of 19 (Total in Forum: 19) (Refresh)FirstPrevNext
QuestionformulasmemberSilentSage4:48 31 Dec '08  
QuestionExcel Exportmemberdrshreya10:02 18 Sep '08  
GeneralYou are really the bestmemberminatharwat12:55 23 Jan '07  
GeneralTakes ages ....memberoobject21:19 5 Sep '06  
GeneralRe: Takes ages .... [modified]memberTim Schwallie11:01 30 Jan '07  
GeneralRe: Takes ages ....memberTim Schwallie5:20 31 Jan '07  
QuestionApplication will not open but process does openmemberMariaelisau10:50 6 Jul '06  
GeneralSpecifing Excel File NamememberAli Hussian Al-Faraj22:20 6 Jun '06  
GeneralAssemblies missingmemberlbispo6:30 4 May '06  
GeneralAccess Denied errormembersrichikka0:01 3 May '06  
GeneralRe: Access Denied errormemberMukesh_B23:36 27 Aug '06  
GeneralAccess is denied.memberoneforall20129:53 28 Apr '06  
GeneralWhere's the article?memberexhaulted0:03 22 Feb '06  
GeneralAccess is deniedmemberL. Des Lierres9:01 21 Feb '06  
GeneralRe: Access is deniedmemberL. Des Lierres15:08 28 Feb '06  
GeneralRe: Access is deniedmemberL. Des Lierres9:28 29 Jun '06  
GeneralRe: Access is deniedmemberL. Des Lierres9:29 29 Jun '06  
GeneralThis article is excellentmemberTigger9917:39 7 Feb '06  
GeneralExporting Russian Characters to a CSV FilememberMSJ_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
Web17 | Advertise on the Code Project