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.

How to add more than one datatable?

Thread ID:

Created:

Updated:

Platform:

Replies:

52251 Nov 24,2006 01:36 AM Nov 27,2006 12:37 PM Windows Forms 3
loading
Tags: XlsIO
Sandeep
Asked On November 24, 2006 01:36 AM

Hi,
I want to export data to excel file.

I tried with ImportDataTable method. I am able to successfuly import datatable to the excel. But as I tries to import other table it overwrites the previous data.

Is there any way so that I can import datatable one by one to the excel. i.e. I should be able to append tables to excel.

Thanks,
Sandeep

Chella Pandian B [Syncfusion]
Replied On November 24, 2006 11:40 AM

Hi Sandeep

You can append as many data tables in a sheet by changing it row value.

sheet.ImportDataTable (dataTable, false, 1, 1, -1, -1);

sheet.ImportDataTable (dataTable, false, sheet.Rows.Length +2 , 1, -1, -1);

sheet.ImportDataTable (dataTable, false, sheet.Rows.Length +2, 1, -1, -1);

Let me know any other difficulties.

With regards,
Chella.

Sandeep
Replied On November 27, 2006 12:41 AM


Hi Chella,

Thank you very much. It solved my problem.
But now I want to some more things with this.

Situations is like this.
I have suppose ten datatables.
I will import one by one.
But before every table I want to give some details about table like header.
How I can add individual row in Excel Sheet for this. I tried with insertrow but I am not able to add data to it.

Please provide me the solution.

Thanks,
Sandeep

Chella Pandian B [Syncfusion]
Replied On November 27, 2006 12:37 PM

Hi Sandeep

Adding some text in-between the Data table can be done using the following code.

sheet.Range[1,1].Text = "Table Header 1";
sheet.ImportDataTable (dt, false, 2, 1, -1, -1);

sheet.Range[sheet.Rows.Length+2,1].Text = "Table Header 2";
sheet.ImportDataTable (dt, false, sheet.Rows.Length+2 , 1, -1, -1);

sheet.Range[sheet.Rows.Length+2,1].Text = "Table Header 3";
sheet.ImportDataTable (dt, false, sheet.Rows.Length+2 , 1, -1, -1);

Let me know whether this what you where looking at. Thanks for using XlsIO.

With Regards,
Chella.

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.

;