Horje
exceldatareader example c# Code Example
exceldatareader example c#
1
private void btnBrowse_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.Filter = "Excel Files(.xlsx)|*.xlsx";
            this.openFileDialog1.Title = "Select an excel file";
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                this.txtPath.Text = openFileDialog1.FileName;
                FileStream stream = File.Open(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
                IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                DataSet result = excelReader.AsDataSet();
 
                var people = new List<Person>();
                while (excelReader.Read())
                {
                    people.Add(new Person
                    {
                        FirstName = excelReader.GetString(0),
                        LastName = excelReader.GetString(1)
                    });
                }
 
                this.resultGrid.DataSource = people;
            }
        }




Csharp

Related
Unity mousetoterrainposition Code Example Unity mousetoterrainposition Code Example
opération inter-threads non valide Code Example opération inter-threads non valide Code Example
Filter list contents with predicate (anonymous method) Code Example Filter list contents with predicate (anonymous method) Code Example
for what is percent sign in unity c# Code Example for what is percent sign in unity c# Code Example
vb.net windows version check Code Example vb.net windows version check Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9