Esempio n. 1
0
        /// <summary>
        /// 测试记录表格输出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TestListOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "Excel(.xlsx) | *.xlsx|Excel(.xls) | *.xls";
            string UIKey      = "TestListOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string UIKey2     = "TestListTemplateteBox";
            string sFilePath  = UIdictionary[UIKey].MyString;

            UIdictionary[UIKey1].MyString = "";
            //try
            //{

            bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);

            if (bOpenEnable == true)
            {
                BaseFactory factory = new BaseFactory();
                factory.BaseParameter = CreateConvertParameter();


                TestList listData = (TestList)factory.CreatDataClass("TestList");
                CreateDataMath <List <TestSheetRow>, ConveyorRow> testdataMath = listData.CreateTestRows;
                CreateDataMath <List <string>, ConveyorRow>       cmcdataMath  = listData.CreateCMCRows;
                List <List <TestSheetRow> > testDataRows = listData.CreateList(testdataMath);
                List <List <string> >       cmcDataRows  = listData.CreateList(cmcdataMath);
                NpoiExcelFunction.ExcelWrite(sFilePath, "CMC", cmcDataRows);
                NpoiExcelFunction.ExcelWrite(sFilePath, "Test", testDataRows);
                UIdictionary[UIKey].MyString = sFilePath;

                //NpoiExcelFunction.ExcelWrite(sFilePath, (ListData as TestList).ListData);
                UIdictionary[UIKey1].MyString = "Output Test List successful!";
            }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("Build Test List Error: " + ex.Message);
            //}
            GC.Collect();
        }