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 import a xlsx file into Essential Grid?

Thread ID:





97662 Dec 22,2010 10:05 AM UTC Jan 3,2011 11:45 AM UTC WinForms 4
Tags: GridControl
Sergey Koroliov
Asked On December 22, 2010 10:05 AM UTC

I have Syncfusion
Is it possible to import a xlsx file into Essential Grid?
I've run your example "GC XLS Export Demo" from Essential Studio Samples\Grid samples tree. It imports xls files fine but if I select a xlsx file this string:

gecc.ExcelToGrid( openFileDialog.FileName, this.gridControl1.Model);

returns null reference exception:

{"Value cannot be null.\r\nParameter name: root"}

Jisha Joy [Syncfusion]
Replied On December 23, 2010 09:20 AM UTC

Hi Sergey,

I have tested the issue in the "GC XLS Export Demo" sample. The importing of xlsx file to gridcontrol is working fine as expected. Please provide us the complete stack trace of the exception you are getting. So that we could analyze it further.


Sergey Koroliov
Replied On December 23, 2010 02:26 PM UTC

Hi Jisha

I’ve managed to reproduce the exception in PC with Windows 7 64bit and in PC with Windows XP 32bit.
I am using Syncfusion

You can see my steps to reproduce the exception in attached archive - Import_xlsx.png file
I also included the file that I tried to import - data_M1.xlsx

Regards, Sergey


Jisha Joy [Syncfusion]
Replied On December 29, 2010 09:10 AM UTC

Hi Sergey,

You could solve the issue by opening the grid manually providing the ExcelOpenType to Automatic while opening the workbook, then the grid can be imported from the sheet of the workbook.

Please refer the code below:

ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook myWorkbook = null;
myWorkbook = excelEngine.Excel.Workbooks.Open("data_M1.xlsx", ExcelOpenType.Automatic);
IWorksheet mySheet = myWorkbook.Worksheets[0];
GridExcelConverterControl gecc = new GridExcelConverterControl();
gecc.ExcelToGrid(mySheet, this.gridControl1.Model);


Sergey Koroliov
Replied On January 3, 2011 11:45 AM UTC

Hi Jisha

Thank you! It works fine.

Regards, Sergey


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