Beispiel #1
0
        private void createEach(List <ResultItem> allValue, string townName)
        {
            ReportFromTemplate report       = new ReportFromTemplate();
            string             templateFile = templateText.Text;;

            report.CreateNewDucument(templateFile);

            int number   = 2;
            int picIndex = 1;

            foreach (ResultItem s in allValue)
            {
                int m_iErrCnt = 0;
                while (s.RegionID.Contains(townName) && s.Figure.Contains("-02") && (s.Category.Contains("建筑垃圾") || s.Category.Contains("生活垃圾")))
                {
                    try
                    {
                        MessageFilter.Register();
                        report.CopyTable();
                        if (report.InsertInfo(ref number, s, ref picIndex, insitu.Text, sShot.Text))
                        {
                            number++;
                        }
                        MessageFilter.Revoke();
                        break;
                    }
                    catch (SystemException err)
                    {
                        m_iErrCnt++;
                        if (m_iErrCnt < 3)
                        {
                            System.Threading.Thread.Sleep(1000);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                //if (number > 20) break;
            }
            report.deletePage(1);

            string[] contents = new string[2];
            contents[0] = "青浦区" + townName + "2019" + "02" + "期";
            contents[1] = "固体废弃物第三方测评报告";
            report.insertFirstPage(contents);

            string townDirectory = outputPath.Text + @"\" + townName + "-201902期";

            if (!Directory.Exists(townDirectory))
            {
                Directory.CreateDirectory(townDirectory);
            }
            report.SaveDocument(townDirectory + @"\青浦区" + townName + "201902期" + "固体废弃物第三方测评报告" + ".docx");
        }
Beispiel #2
0
        private void createAllFuhe(List <ResultItem> allValue)
        {
            ReportFromTemplate report       = new ReportFromTemplate();
            string             templateFile = @"D:\青浦区垃圾巡查\0301.docx";

            report.CreateNewDucument(templateFile);

            int number   = 2;
            int picIndex = 1;

            foreach (ResultItem s in allValue)
            {
                int m_iErrCnt = 0;
                while (!s.Figure.Contains(flag) && (s.Category.Contains("建筑垃圾") || s.Category.Contains("生活垃圾")))
                {
                    try
                    {
                        MessageFilter.Register();
                        report.CopyTable();
                        if (report.InsertInfo(ref number, s, ref picIndex, insituText.Text, dstPath + @"\截图"))
                        {
                            number++;
                        }
                        MessageFilter.Revoke();
                        break;
                    }
                    catch (SystemException err)
                    {
                        m_iErrCnt++;
                        if (m_iErrCnt < 3)
                        {
                            System.Threading.Thread.Sleep(1000);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                //if (number > 20) break;
            }
            report.deletePage(1);
            string[] contents = new string[2];
            contents[0] = "青浦区" + phase.Text + "期";
            contents[1] = "固体废弃物第三方测评报告";
            report.insertFirstPage(contents);

            string townDirectory = dstPath + @"\报告\";

            if (!Directory.Exists(townDirectory))
            {
                Directory.CreateDirectory(townDirectory);
            }
            report.SaveDocument(townDirectory + @"青浦区" + phase.Text + "期" + "固体废弃物复核点位报告" + ".docx");
        }