Exemplo n.º 1
0
        public List <string> CreateReportWord()
        {
            string        appStatus;
            string        strRet  = null;
            List <string> appList = new List <string>();  //函数执行状态+文件名

            //测试使用的是fristpage

            using (m_wordApp = new Word.Application())
            {
                #region  定义类
                WriteFirstPage FirstPage = new OfficeDocGenerate.WriteFirstPage("ProjectNumber", "CompaneName");
                #endregion
                m_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
                m_utils = new Word.Tools.CommonUtils(m_wordApp);
                m_doc   = m_wordApp.Documents.Add();

                //SetPage();
                WriteFirstPage(model.ProjectNumber, model.CompaneName, model.ContractDate.Year + "年" + model.ContractDate.Month + "月" + model.ContractDate.Day + "日");

                //      m_doc.Paragraphs.Last.Range.InsertBreak();
                WriteInstruction();
                //         m_doc.Paragraphs.Last.Range.InsertBreak();
                appStatus = "0";
                //WriteTestReport(ParmeterChemicalModels, physicalmodels, chemicalmodels, str);
                strRet = SaveFile();
                appList.Add(appStatus);
                appList.Add(strRet);
            }
            return(appList);
        }
        public List <string> CreateReportWord(List <string> strc, ProjectInfo projectmodels, List <TestChemicalReport> chemicalmodels)
        {
            string        appStatus;
            string        strRet  = null;
            List <string> appList = new List <string>();  //函数执行状态+文件名

            //测试使用的是fristpage

            using (m_wordApp = new Word.Application())
            {
                #region  定义类
                WriteFirstPage FirstPage = new OfficeDocGenerate.WriteFirstPage("2016SJ018", "北京京门世纪物业管理有限公司");
                #endregion
                m_wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
                m_utils = new Word.Tools.CommonUtils(m_wordApp);
                m_doc   = m_wordApp.Documents.Add();

                //SetPage();
                WriteFirstPage(FirstPage.ReportNumber, FirstPage.Client, projectmodels.CreateTime.Year.ToString() + "年" + projectmodels.CreateTime.Month.ToString() + "月" + projectmodels.CreateTime.Day.ToString() + "日");
                m_doc.Paragraphs.Last.Range.InsertBreak();
                //         m_doc.Paragraphs.Last.Range.InsertBreak();
                WriteContent();
                m_doc.Paragraphs.Last.Range.InsertBreak();
                appStatus = WriteEmployerBasicInfo(projectmodels);
                WriteTestReport(chemicalmodels, strc);
                strRet = SaveFile();
                appList.Add(appStatus);
                appList.Add(strRet);
            }
            return(appList);
        }