コード例 #1
0
        public void TestSaveExcel()
        {
            string             ExcelPath   = @"D:\ConceptFlower Test\Epass Stage 1 & 2 automation tool.xlsx";
            ExcelEditor        excelHandel = new ExcelEditor();
            List <WhiteListcs> wlist       = new List <WhiteListcs>();
            WhiteListcs        model       = new WhiteListcs {
                PM_AC            = "PC", Membership_No = "12345678-123456789", ERID = "21456789", Case_Number = "5454579859"
                , Name_in_AS400  = "test", Name_in_XML = "test", Name_Pass = "******", Clean_Case = "Y", Unclean_Reason = new StringBuilder("sdfasdfsfds"), Signature_Pass = "******"
                , Withdraw_NT_PM = "NT", Process_result = "Process"
            };

            wlist.Add(model);
            var       excel = excelHandel.Open(ExcelPath);
            DataTable dt    = ListToDatatableHelper.ToDataTable <WhiteListcs>(wlist);

            excel.SaveDataTableToExcel(dt, ExcelPath, "White List");
        }
コード例 #2
0
        public void readexcel()
        {
            List <WhiteListcs> wlist       = new List <WhiteListcs>();
            ExcelEditor        excelHandel = new ExcelEditor();

            //int index = 1;

            //WhiteListcs w1 = new WhiteListcs();

            //w1.Name_in_AS400 = "test";
            //w1.Case_Number = "5454579859";
            //w1.Clean_Case = "Y";
            //w1.ERID = "21456789";
            //w1.ExtentionNo = "81634";
            //w1.Name_Pass = "******";
            //w1.Membership_No = "12345678-123456789";
            //w1.PM_AC = "PC";
            //w1.Signature_Pass = "******";
            //w1.Unclean_Reason.Append("sfdtrtyrturtutyuityurt");
            //w1.Withdraw_NT_PM = "NT";
            //w1.Name_in_XML = "test";

            //wlist.Add(w1);

            //WhiteListcs w2 = new WhiteListcs();

            //w2.Name_in_AS400 = "test";
            //w2.Case_Number = "5454579859";
            //w2.Clean_Case = "Y";
            //w2.ERID = "21456789";
            //w2.ExtentionNo = "81634";
            //w2.Name_Pass = "******";
            //w2.Membership_No = "12345678-123456789";
            //w2.PM_AC = "PC";
            //w2.Signature_Pass = "******";
            //w2.Unclean_Reason.Append("sfdtrtyrturtutyuityurt");
            //w2.Withdraw_NT_PM = "NT";
            //w2.Name_in_XML = "test";

            //wlist.Add(w2);


            //if (wlist.Count > 0)
            //{
            //    var excel = excelHandel.Open(@"E:\Epass Stage 1 & 2 automation tool.xlsx");

            //    DataTable dt = ListToDatatableHelper.ToDataTable<WhiteListcs>(wlist);

            //    excel.SaveDataTableToExcel(dt, @"E:\Epass Stage 1 & 2 automation tool.xlsx", "White List");


            //}


            List <ExcelWhlist> ewlist = new List <ExcelWhlist>();

            ExcelWhlist ew = new ExcelWhlist();

            ew.Name_in_AS400 = "test";
            ew.Case_Number   = "5454579859";
            ew.Clean_Case    = "Y";
            ew.ERID          = "21456789";
            //ew.ExtentionNo = "81634";
            ew.Name_Pass      = "******";
            ew.Membership_No  = "12345678-123456789";
            ew.PM_AC          = "PC";
            ew.Signature_Pass = "******";
            ew.Unclean_Reason = "fdsdsdsd";
            ew.Withdraw_NT_PM = "NT";
            ew.Name_in_XML    = "test";
            ew.RowIndex       = "2";
            ew.Process_result = "Processed";
            //ew.Message_Mark = "Y";
            ewlist.Add(ew);

            if (ewlist.Count > 0)
            {
                var excel = excelHandel.Open(@"E:\Epass Stage 1 & 2 automation tool.xlsx");
                excel.SetSpecifiedToExcel(ewlist, @"E:\Epass Stage 1 & 2 automation tool.xlsx", "White List");
            }
        }