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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add more than one datatable?

Thread ID:





52251 Nov 24,2006 06:36 AM UTC Nov 27,2006 05:37 PM UTC WinForms 3
Tags: XlsIO
Asked On November 24, 2006 06:36 AM UTC

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.


Chella Pandian B [Syncfusion]
Replied On November 24, 2006 04:40 PM UTC

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,

Replied On November 27, 2006 05:41 AM UTC

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.


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

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,


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon