Hi
I used the following code for import it works slowly,how can I improve itSpeed?I don't want to import from xml,
private void Button_Click(object sender, RoutedEventArgs e) { OpenFileDialog flDialog = new OpenFileDialog(); flDialog.Filter = "Excel Files(*.xlsx)|*.xlsx"; bool res = (bool)flDialog.ShowDialog(); if (res) { FileInfo fs = flDialog.File; string fileName = fs.Name; #region Reading Data From Excel File dynamic objExcel = AutomationFactory.CreateObject("Excel.Application"); //Open the Workbook Here dynamic objExcelWorkBook = objExcel.Workbooks.Open(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + fileName); //Read the Worksheet dynamic objActiveWorkSheet = objExcelWorkBook.ActiveSheet(); //Cells to Read dynamic objCell_1, objCell_2; //Iterate through Cells for (int count = 2; count < 300; count++) { objCell_1 = objActiveWorkSheet.Cells[count, 1]; objCell_2 = objActiveWorkSheet.Cells[count, 2]; populationData.Add ( new PopulationClass() { StateName = objCell_1.Value, Population = objCell_2.Value } ); } dgExcelData.ItemsSource = populationData; #endregion } }