private void Click_Imprimer(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application oXL; Microsoft.Office.Interop.Excel._Workbook oWB; Microsoft.Office.Interop.Excel._Worksheet oSheet; Microsoft.Office.Interop.Excel.Range oRng; object M = System.Reflection.Missing.Value; try { //Start Excel and get Application object. oXL = new Microsoft.Office.Interop.Excel.Application(); oXL.Visible = true; //Get a new workbook. oWB = (Microsoft.Office.Interop.Excel._Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value)); oSheet = (Microsoft.Office.Interop.Excel._Worksheet)oWB.ActiveSheet; //Add table headers going cell by cell. oSheet.Cells[1, 1] = this.lblCodeEleve.Text; oSheet.Cells[1, 2] = this.lblNom.Text; oSheet.Cells[1, 3] = this.lblPrenom.Text; oSheet.Cells[1, 4] = this.lblDateNaissance.Text; oSheet.Cells[2, 1] = this.txtCodeEleve.Text; oSheet.Cells[2, 2] = this.txtNomEleve.Text; oSheet.Cells[2, 3] = this.txtPrenomEleve.Text; oSheet.Cells[2, 4] = this.txtDateNaissance.Text; } catch (FileNotFoundException Lg) { MessageBox.Show(Lg.Message, "Erreur"); } }