Click here to Skip to main content
Click here to Skip to main content

DataSet to Excel in Two steps – with Different Styles

By , 30 Jul 2005
 

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
United Arab Emirates United Arab Emirates
Member
Software Engineer from India,Working in .NET for 2 years.

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

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 4memberSatyavir Yadav from New Delhi22 Apr '13 - 2:13 
QuestionError on Line workbook = workbooks.Add(true); on Windows Server 2008 + IIS 7memberkeyur_parekh24 Oct '12 - 4:51 
QuestionThe Solution works great but..memberPooja H Borhade1 Nov '11 - 21:02 
QuestionWell Done!memberTadesse21 Jun '11 - 11:06 
GeneralMy vote of 1membernavbingo2026 May '11 - 0:52 
GeneralRe: My vote of 1memberrama charan25 Jun '12 - 0:53 
QuestionErrors when compiling your source code in Visual Studio 2010membermoiztankiwala10 Jun '10 - 10:29 
AnswerRe: Errors when compiling your source code in Visual Studio 2010memberTadesse21 Jun '11 - 10:52 
Generalthank's!, works ifmembercheluskis10 Sep '09 - 10:03 
QuestionformulasmemberSilentSage31 Dec '08 - 3:48 
QuestionExcel Exportmemberdrshreya18 Sep '08 - 9:02 
GeneralYou are really the bestmemberminatharwat23 Jan '07 - 11:55 
GeneralTakes ages ....memberoobject5 Sep '06 - 20:19 
GeneralRe: Takes ages .... [modified]memberTim Schwallie30 Jan '07 - 10:01 
GeneralRe: Takes ages ....memberTim Schwallie31 Jan '07 - 4:20 
GeneralRe: Takes ages ....memberCikaPero28 Feb '10 - 21:27 
QuestionApplication will not open but process does openmemberMariaelisau6 Jul '06 - 9:50 
GeneralSpecifing Excel File NamememberAli Hussian Al-Faraj6 Jun '06 - 21:20 
GeneralAssemblies missingmemberlbispo4 May '06 - 5:30 
GeneralAccess Denied errormembersrichikka2 May '06 - 23:01 
GeneralRe: Access Denied errormemberMukesh_B27 Aug '06 - 22:36 
GeneralAccess is denied.memberoneforall201228 Apr '06 - 8:53 
QuestionWhere's the article?memberexhaulted21 Feb '06 - 23:03 
GeneralAccess is deniedmemberL. Des Lierres21 Feb '06 - 8:01 
GeneralRe: Access is deniedmemberL. Des Lierres28 Feb '06 - 14:08 
GeneralRe: Access is deniedmemberL. Des Lierres29 Jun '06 - 8:28 
GeneralRe: Access is deniedmemberL. Des Lierres29 Jun '06 - 8:29 
GeneralThis article is excellentmemberTigger997 Feb '06 - 16:39 
GeneralExporting Russian Characters to a CSV FilememberMSJ_PK2 Aug '05 - 19:27 

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

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