private void createNewDoc(string docName) { ReportFromTemplate report = new ReportFromTemplate(); string templateFile = @"D:\三个区\0610.docx"; report.CreateNewDucument(templateFile); report.SaveDocument(docName); }
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"); }
private void rest(string directory) { //删除第一页,并在每一页下方添加页码 ReportFromTemplate report = new ReportFromTemplate(); report.CreateNewDucument(directory); report.deletePage(1); report.insertPageNumber("center", true); report.SaveDocument(directory); }
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"); }
private void ThreadTestAll() { ReportFromTemplate report = new ReportFromTemplate(); string templateFile = templateText.Text; report.CreateNewDucument(templateFile); getAllshp(shpPathText.Text); Invoke(new MethodInvoker(() => { progWorkQP.Maximum = allValue.Count; progWorkQP.Value = 0; })); int number = 2; int picIndex = 1; foreach (ResultItem s in allValue) { int m_iErrCnt = 0; while (true) { try { MessageFilter.Register(); report.CopyTable(); if (report.InsertInfo(ref number, s, ref picIndex, insitu.Text, sShot.Text)) { number++; Invoke(new MethodInvoker(() => { progWorkQP.Value = number - 2; })); } 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); report.SaveDocument(outputPath.Text + @"\" + "垃圾监测总报告.docx"); MessageBox.Show("完成!"); }
private void button2_Click(object sender, EventArgs e) { ReportFromTemplate report = new ReportFromTemplate(); string templateFile = @"D:\青浦区垃圾巡查\0301.docx"; report.CreateNewDucument(templateFile); string[] contents = new string[2]; contents[0] = "侧是是是是"; contents[1] = "1123123123123"; report.insertPage(contents); report.deletePage(1); report.insertPageNumber("center", true); report.SaveDocument(@"D:\" + "aaaaaaaaaaaaaaa.docx"); }
private void createAll(List <ResultItem> all, string directory, string d) { ReportFromTemplate report = new ReportFromTemplate(); report.CreateNewDucument(directory); int number = 2; int picIndex = 1; foreach (ResultItem s in allValue) { int m_iErrCnt = 0; while (s.District == d) { try { MessageFilter.Register(); report.CopyTable(); if (report.InsertInfo(ref number, s, ref picIndex, 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 output = @"D:\三个区\" + d + ".docx"; report.SaveDocument(output); }
private void createAll(List <ResultItem> allValue, string town, string directory, ref int number, ref int picIndex) { ReportFromTemplate report = new ReportFromTemplate(); report.CreateNewDucument(directory); List <ResultItem> XinZeng = new List <ResultItem>(); List <ResultItem> FuHe = new List <ResultItem>(); foreach (ResultItem s in allValue) { if (s.RegionID == town && s.Figure.Contains(flag)) { XinZeng.Add(s); } else if (s.RegionID == town && !s.Figure.Contains(flag)) { FuHe.Add(s); } } #region 添加新增点位 string[] contents = new string[2]; contents[0] = town + "新增"; contents[1] = phase.Text + "期固体废弃物新增点位信息"; report.insertPage(contents); foreach (ResultItem s in XinZeng) { int m_iErrCnt = 0; while (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; } } } } #endregion #region 添加复核点位 string[] contents2 = new string[2]; contents2[0] = town + "复核"; contents2[1] = phase.Text + "期固体废弃物复核点位信息"; report.insertPage(contents2); foreach (ResultItem s in FuHe) { int m_iErrCnt = 0; while (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; } } } } #endregion report.SaveDocument(directory); }