We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Export to excel from data table

Thread ID:

Created:

Updated:

Platform:

Replies:

50419 Oct 11,2006 07:46 AM Oct 12,2006 01:24 AM Windows Forms 1
loading
Tags: XlsIO
Anna Srinivasan
Asked On October 11, 2006 07:46 AM

Hi,
I want to export data to excel from data table and also I would like to know if the he data table contains for example 100 rows, first 30 rows should display to one page remaining 70 rows should display to another page. Basically How do I use page breaker in the excel sheet object. Kindly give me sample to see the same.

Regards,
Anna

Melba Winshia [Syncfusion]
Replied On October 12, 2006 01:24 AM

Hi Anna,

1) Use the following code snippets to export data to excel from data table.

[C#]

//Import data table
sheet.ImportDataTable(dataTable,true,1,1,30,-1,true);

2) Here is the sample for your reference to set first 30 rows in one sheet and remaining 70 rows in other sheet.

 ImportDataTable.zip


3) Use the following code snippets to set page breaker in Excel object.

// Giving Horizontal pagebreaks
sheet.HPageBreaks.Add( sheet.Range[ "A5" ] );

// Giving Vertical pagebreaks
sheet.VPageBreaks.Add( sheet.Range[ "B5" ] );

Here is the sample for your reference:

PageBreak.zip


Please take a look and let me know if you have any other questions.

Thanks,
Melba

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;