How to import a xlsx file into Essential Grid?
Hi
I have Syncfusion 8.2.0.18
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"}
I have Syncfusion 8.2.0.18
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"}
SIGN IN To post a reply.
4 Replies
JJ
Jisha Joy
Syncfusion Team
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.
Regards,
Jisha
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.
Regards,
Jisha
SK
Sergey Koroliov
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 8.2.0.18.
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
Import_xlsx_953ad572.zip
I’ve managed to reproduce the exception in PC with Windows 7 64bit and in PC with Windows XP 32bit.
I am using Syncfusion 8.2.0.18.
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
Import_xlsx_953ad572.zip
JJ
Jisha Joy
Syncfusion Team
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);
Regards,
Jisha
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);
Regards,
Jisha
SK
Sergey Koroliov
January 3, 2011 11:45 AM UTC
Hi Jisha
Thank you! It works fine.
Regards, Sergey
Thank you! It works fine.
Regards, Sergey
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
SK Sergey Koroliov
- Dec 22, 2010 10:05 AM UTC
- Jan 3, 2011 11:45 AM UTC