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

Leave out the first row for headines and fill the rest of the excel with a given List<string[]>?

Thread ID:





123666 Apr 8,2016 08:56 AM UTC Apr 12,2016 09:12 AM UTC ASP.NET MVC 4
Tags: XlsIO
Asked On April 8, 2016 08:56 AM UTC

I have:

            //todo: convertiere objekte in die Tabelle

            ExcelEngine excelEngine = new ExcelEngine();

            IApplication application = excelEngine.Excel;

            application.DefaultVersion = ExcelVersion.Excel2013;

            IWorkbook workbook = application.Workbooks.Create(1);

            IWorksheet worksheet = workbook.Worksheets[0];

            //Import the data to worksheet.
            worksheet.ImportData(_excelObjekt, 2, 1, false);//  "excelObjekt" contains a List<string[]>



But this will return a new empty excel file ...

Replied On April 9, 2016 04:40 AM UTC

no, i managed it with a for loop and ""worksheet.ImportData(_excelObjekt, ..., false);//  "excelObjekt" contains a List<string[]> to fill an excel, but he clears out the first row of my excel, but there was some writing in it before, what to do?

Abirami Varadharajan [Syncfusion]
Replied On April 11, 2016 01:03 PM UTC

Hi Testname,

Thank you for contacting Syncfusion support.

We are able to reproduce the issue. As per XlsIO behaviour, ImportData method imports only the list objects in the specified row and column. We request you to use ImportArray method to import list of string array. Kindly refer the below code example to achieve your requirement and let us know if it helps.

Code Example:

            ExcelEngine excelEngine = new ExcelEngine();

            IApplication application = excelEngine.Excel;

            IWorkbook workbook = application.Workbooks.Create(2);

            IWorksheet worksheet = workbook.Worksheets[0];

            List<string[]> quarters = new List<string[]>();

            string[] quarter1={"Jan","Feb","Mar"};

            string[] quarter2 = { "Apr","May", "Jun" };

            string[] quarter3 = { "jul", "aug","sep" };

            string[] quarter4 = { "oct", "nov", "dec" };





            for (int i = 0; i < quarters.Count; i++)


                worksheet.ImportArray(quarters[i], 2 + i, 1, false);


            workbook.Version = ExcelVersion.Excel2013;





Replied On April 11, 2016 01:12 PM UTC

How to use your example with a given Memorystream( with the existing excel document) ?

Abirami Varadharajan [Syncfusion]
Replied On April 12, 2016 09:12 AM UTC

Hi Testname,

As per your requirement, we have prepared a sample with an existing excel document as a memory stream. Kindly refer the sample which can be downloaded from the following link.

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/ImportStringData-614611913.zip

Please let us know if you have any concerns.



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