private void export_btn_Click(object sender, EventArgs e) { if (folderDialog1.ShowDialog() == DialogResult.OK && table != null && table.Rows.Count > 0) { try { var folder = folderDialog1.SelectedPath; var fileName = folder + @"\" + nomFile_tb.Text; bool dtOnFN = dateFileName_cb.Checked; //header colsName = colNames_cb.Checked; date = dateHeader_cb.Checked; #region ReglageFooter count = count_cb.Checked; if (sum != null) { sum.Clear(); //les sommes foreach (var item in sum_list.CheckedItems) { sum.Add(sum_avg[sum_list.Items.IndexOf(item)].Ordre); } } if (avg != null) { avg.Clear(); //les moyennes foreach (var item in avg_list.CheckedItems) { avg.Add(sum_avg[avg_list.Items.IndexOf(item)].Ordre); } } #endregion //Exportation exporter.SetPrerequisites(table, fileName, true); exporter.SetHeader(date, nomEvent, colsName); exporter.SetFooter(count, sum, avg); exporter.Exporter(separateur); MetroMessageBox.Show(this, "Exportation Terminée Avec Succées", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { MetroMessageBox.Show(this, "Une Erreur Est Survenu Lors De l'Exportation", "Erreur d'Exportation", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MetroMessageBox.Show(this, "Il y aucune donnée à exporter", "Table Vide", MessageBoxButtons.OK, MessageBoxIcon.Information); } }