private void set_to_excell(string[,] a, int rowC) { // AccountingKernel.Forms. ExcelImpExp.ExportToExcel exp = new ExcelImpExp.ExportToExcel(); var table = new System.Data.DataTable(); table = exp.get_dataGridColumnNames(grdBenefitAndDeductionsLists); for (int i = 0; i <= rowC - 1; i++) { var row = table.NewRow(); for (int j = 0, b = 0; j <= 10; j++) { if (j != 2 && j != 3) { row[this.grdBenefitAndDeductionsLists.Columns[j + 1].Header.ToString()] = a[i, b]; b++; } } table.Rows.Add(row); } DataSet ds = new DataSet("New_DataSet"); ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture; ds.Tables.Add(table); exp.showStuff(ds); }
private void set_to_excell(string[,] a, int rowC) { ExcelImpExp.ExportToExcel exp = new ExcelImpExp.ExportToExcel(); var table = new System.Data.DataTable(); string[] arr_names = new string[9];//تعداد ستون for (int i = 0, c = 0; i <= grdPerson.Columns.Count - 1; i++) { if (grdPerson.Columns[i].Visibility != System.Windows.Visibility.Hidden) { arr_names[c] = grdPerson.Columns[i].Header.ToString(); c++; } } table = exp.get_dataGridColumnNames(grdPerson, arr_names); for (int i = 0; i <= rowC - 1; i++) { var row = table.NewRow(); for (int j = 0, b = 0; j <= 15; j++) { if (j == 0 || j == 1 || j == 2 || j == 3 || j == 5 || j == 6 || j == 8 || j == 9 || j == 12) { row[this.grdPerson.Columns[j + 1].Header.ToString()] = a[i, b]; b++; } } table.Rows.Add(row); } DataSet ds = new DataSet("New_DataSet"); ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture; ds.Tables.Add(table); exp.showStuff(ds); }