public void consolidatedreport(string emails)
        {
            try
            {
                var p = 0;
                var f = 0;
                for (var i = 0; i < Dt.Rows.Count; i++)
                {
                    var value = Dt.Rows[i]["PASS or FAIL"].ToString();
                    if (value == "PASS")
                    {
                        p = p + 1;
                    }
                    if (value == "FAIL")
                    {
                        f = f + 1;
                    }
                }
                var P = p.ToString(CultureInfo.InvariantCulture);
                var F = f.ToString(CultureInfo.InvariantCulture);

                var d = 0;
                foreach (DataRow dr in Dt.Rows)
                {
                    if (d == 0)
                    {
                        //need to set value to MyRow column
                        dr[4] = "Total Number of Test Cases Passed" + "-" + P;
                    }
                    // or set it to some other value
                    if (d == 1)
                    {
                        dr[4] = "Total Number of Test Cases Failed" + "-" + F;
                        break;
                    }
                    d++;
                }

                var ReportName = "Consolidated Report";

                GeneralLibrary = new GeneralLibrary();

                var wb = GeneralLibrary.CreateAndOpenExcelFile(@"C:\Selenium\Input Data", ref ReportName, "Report",
                                                                    ".xlsx", false, true);
                Worksheet ws = wb.Sheets[1];
                GeneralLibrary.ConsolidatedXmlExportToExcel(MergeTable, ws, true, false, false);
                GeneralLibrary.SaveAndCloseExcel(wb);
                var ghdg = new GenerateEmail();
                ghdg.SendEMail(ReportName, emails);

                var Html = new ConverttoHtml();
                Html.ConvertDataTableToHtml(MergeTable, ReportName, P, F);

                foreach (var process in Process.GetProcessesByName("EXCEL").Where(process => process.MainModule.ModuleName.ToUpper().Equals("EXCEL.EXE")))
                {
                    process.Kill();
                    break;
                }
            }
            catch (Exception)
            {
            }
        }
        public void Excelsave(string reportName, IWebDriver driver, string email)
        {
            try
            {
                var p = 0;
                var f = 0;
                for (var i = 0; i < Dt.Rows.Count; i++)
                {
                    var value = Dt.Rows[i]["PASS or FAIL"].ToString();
                    if (value == "PASS")
                    {
                        p = p + 1;
                    }
                    if (value == "FAIL")
                    {
                        f = f + 1;
                    }
                }
                var P = p.ToString(CultureInfo.InvariantCulture);
                var F = f.ToString(CultureInfo.InvariantCulture);

                TotalPass = P + TotalPass;
                TotalFail = F + TotalFail;

                var d = 0;
                foreach (DataRow dr in Dt.Rows)
                {
                    if (d == 0)
                    {
                        //need to set value to MyRow column
                        dr[4] = "Total Number of Test Cases Passed" + "-" + P;
                    }
                    // or set it to some other value
                    if (d == 1)
                    {
                        dr[4] = "Total Number of Test Cases Failed" + "-" + F;
                        break;
                    }
                    d++;
                }

                GeneralLibrary = new GeneralLibrary();
                var wb = GeneralLibrary.CreateAndOpenExcelFile(@"C:\Selenium\Input Data", ref reportName, "Report",
                                                                    ".xlsx", false, true);
                Worksheet ws = wb.Sheets[1];
                GeneralLibrary.ConsolidatedXmlExportToExcel(Dt, ws, true, false, false);
                GeneralLibrary.SaveAndCloseExcel(wb);
                var ghdg = new GenerateEmail();
                ghdg.SendEMail(reportName, email);
                Clonetable = Dt.Copy();
                //mergeTable.Merge(clonetable);
                var s = 0;
                foreach (DataRow sourcerow in Clonetable.Rows)
                {
                    if (s <= 2)
                    {
                        var destRow = MergeTable.NewRow();
                        destRow["Total Number of Test Cases Passed/Failed"] =
                            sourcerow["Total Number of Test Cases Passed/Failed"];
                        if (s == 0)
                        {
                            destRow["Merchant Name"] = reportName;
                        }
                        MergeTable.Rows.Add(destRow);
                        s++;
                    }
                    else
                    {
                        break;
                    }
                }

                Dt.TableName = "MyTable";

                var Html = new ConverttoHtml();
                Html.ConvertDataTableToHtml(Dt, reportName, P, F);

                Dt.WriteXml(@"C:\Selenium\Input Data\XML Reports\" + reportName + ".xml");
                foreach (var process in Process.GetProcessesByName("EXCEL").Where(process => process.MainModule.ModuleName.ToUpper().Equals("EXCEL.EXE")))
                {
                    process.Kill();
                    break;
                }
            }
            catch (Exception)
            {
            }
        }