/// <summary> /// 创建县公司文档 /// </summary> public override void createword(string wordpath) { try { lstFM = FDXXtbl_country.GetInfo(CompanyID); FM = FDXXtbl_country.GetTotalInfo(CompanyID); lstPM = FDXXtbl_country.Parcels(lstFM); lstBM = FDXXtbl_country.Buildings(lstFM); //WordPath = wordpath; using (DocX document = DocX.Create(wordpath)) { //document.ApplyTemplate(@"F:\study\国网江苏\svnRealEstate\RealEstate.Web\国网江苏省电力公司\word.dotx");//应用模板 setdoc(document); //设置文档属性 Addcover(document); //添加封面 Addtoc(document); //添加目录 Addintro(document, title_country); //添加概述 Addloc(document); //添加位置分布图 Addfdxx(document); //添加房地信息统计 Addparcels(document); //添加宗地描述 document.Save(); if (docCompilationListener != null) { docCompilationListener.DocCompleted(new DocCompilationArg( CompanyID, wordpath, DocCompilationStatus.Success)); } } } catch (System.Exception ex) { LogHelper.WriteLog(typeof(CreateCountryCompany), ex); if (docCompilationListener != null) { docCompilationListener.DocCompleted(new DocCompilationArg( CompanyID, wordpath, DocCompilationStatus.Fail, ex.Message)); } throw new Exception("生成失败:" + ex.Message); } }
/// <summary> /// 创建县公司文档(作为市公司的下级) /// </summary> /// <param name="document"></param> /// <param name="childcountryName"></param> /// <param name="childcountryID"></param> public void createword(DocX document, Companymodel childcountry, NumoftitleHelper title) { lstFM = FDXXtbl_country.GetInfo((int)childcountry.ID); FM = FDXXtbl_country.GetTotalInfo((int)childcountry.ID); lstPM = FDXXtbl_country.Parcels(lstFM); lstBM = FDXXtbl_country.Buildings(lstFM); if (!childcountry.name.Contains("本部")) { Addintro(document, childcountry, title); //不是市公司本部,则添加概述 } Addloc(document, childcountry, title); //添加位置分布图 Addfdxx(document, childcountry, title); //添加房地信息统计 Addparcels(document, childcountry, title); //添加宗地描述 document.Save(); }
/// <summary> /// 把数据一行行插入(县级公司) /// </summary> /// <param name="t"></param> /// <param name="lsmFM"></param> /// <returns></returns> public static Table inserttable_country(Table t, List <FDXXtbl_country> lsmFM, FDXXtbl_country FM) { int temp = 2; try { t.Rows[temp].Cells[2].Paragraphs.First().Append("" + FM.ZDXX_ZDMJ).Alignment = Alignment.center; t.Rows[temp].Cells[8].Paragraphs.First().Append("" + FM.ZMJ).Alignment = Alignment.center; t.Rows[temp].Cells[9].Paragraphs.First().Append("" + FM.FCXX_DSMJ).Alignment = Alignment.center; t.Rows[temp].Cells[10].Paragraphs.First().Append("" + FM.FCXX_DXMJ).Alignment = Alignment.center; t.Rows[temp].Cells[2].VerticalAlignment = VerticalAlignment.Center;//垂直居中 t.Rows[temp].Cells[8].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[9].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[10].VerticalAlignment = VerticalAlignment.Center; temp++; foreach (FDXXtbl_country fm in lsmFM) { t.InsertRow(); t.Rows[temp].Cells[1].Paragraphs.First().Append(fm.ZDXX_MC).Alignment = Alignment.center; t.Rows[temp].Cells[2].Paragraphs.First().Append("" + fm.ZDXX_ZDMJ).Alignment = Alignment.center; t.Rows[temp].Cells[3].Paragraphs.First().Append(fm.FCXX_JZMC).Alignment = Alignment.center; t.Rows[temp].Cells[4].Paragraphs.First().Append("" + fm.FCXX_DSCS).Alignment = Alignment.center; t.Rows[temp].Cells[5].Paragraphs.First().Append("" + fm.FCXX_DXCS).Alignment = Alignment.center; t.Rows[temp].Cells[6].Paragraphs.First().Append(fm.FCXX_JZJG).Alignment = Alignment.center; t.Rows[temp].Cells[7].Paragraphs.First().Append("" + fm.FCXX_JSND).Alignment = Alignment.center; t.Rows[temp].Cells[8].Paragraphs.First().Append("" + fm.ZMJ).Alignment = Alignment.center; t.Rows[temp].Cells[9].Paragraphs.First().Append("" + fm.FCXX_DSMJ).Alignment = Alignment.center; t.Rows[temp].Cells[10].Paragraphs.First().Append("" + fm.FCXX_DXMJ).Alignment = Alignment.center; t.Rows[temp].Cells[11].Paragraphs.First().Append(fm.FCZK_SYGN).Alignment = Alignment.center; t.Rows[temp].Cells[12].Paragraphs.First().Append(fm.FCZK_SYBM).Alignment = Alignment.center; t.Rows[temp].Cells[13].Paragraphs.First().Append(fm.FCXX_BZ).Alignment = Alignment.center; t.Rows[temp].Cells[1].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[2].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[3].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[4].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[5].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[6].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[7].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[8].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[9].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[10].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[11].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[12].VerticalAlignment = VerticalAlignment.Center; t.Rows[temp].Cells[13].VerticalAlignment = VerticalAlignment.Center; temp++; } } catch (System.Exception ex) { LogHelper.WriteLog(typeof(tableHelper), ex); } return(t); }
/// <summary> /// 插入分层分户平面图 /// </summary> /// <param name="document"></param> /// <param name="lstFM"></param> /// <param name="p"></param> /// <param name="ischild">判断是否作为市级公司的下级</param> public void insertFCFH(DocX document, List <FDXXtbl_country> lstFM, List <Parcelmodel> p, bool ischild, bool istrainings, NumoftitleHelper title) { Paragraph h1_4_1; try { Paragraph h1_4 = document.InsertParagraph(""); FDXXtbl_country temp = new FDXXtbl_country(); foreach (FDXXtbl_country fm in lstFM) { if (temp != null && temp.ZDXX_MC == fm.ZDXX_MC && temp.FCXX_JZMC == fm.FCXX_JZMC) { continue; } temp = fm; //if(fm.ZDXX_MC == Parcelname) if (fm.ZDXX_ID == parcelID) { Picture p_deed = picHelper.getPic(document, PathManager.getSingleton().GetDeedPath(fm.FCXX_ID, false), 450, 886); Picture p_virtual = picHelper.getPic(document, PathManager.getSingleton().GetVirtualmapPath(fm.FCXX_ID, false), 450, 886); List <string> lstStr = txt.txtHelper.txtLines(PathManager.getSingleton().GetPlantxtPath(fm.FCXX_ID, false)); if (h1_4.Text == "") { //if (p_deed != null || p_virtual != null || lstStr.Count != 0 || t != null) //{ if (ischild) { title.Less3Zero(); h1_4 = document.InsertParagraph(title.num3title() + "分层分户平面图"); h1_4.StyleName = "Heading3"; using (FontFamily fontfamily = new FontFamily("宋体")) { h1_4.Color(Color.Black).FontSize(14).Font(fontfamily); } } else if (istrainings) { title.Less4Zero(); h1_4 = document.InsertParagraph(title.num4title() + "分层分户平面图"); h1_4.StyleName = "Heading4"; using (FontFamily fontfamily = new FontFamily("宋体")) { h1_4.Color(Color.Black).FontSize(14).Font(fontfamily); } } else { title.Less2Zero(); h1_4 = document.InsertParagraph(title.num2title() + "分层分户平面图"); h1_4.StyleName = "Heading2"; using (FontFamily fontfamily = new FontFamily("宋体")) { h1_4.Color(Color.Black).FontSize(16).Font(fontfamily); } } //} } if (ischild) { title.Less4Zero(); h1_4_1 = document.InsertParagraph(title.num4title() + fm.FCXX_JZMC + "分层分户平面图"); h1_4_1.StyleName = "Heading4"; using (FontFamily fontfamily = new FontFamily("宋体")) { h1_4_1.Color(Color.Black).FontSize(14).Font(fontfamily).Italic(); } } else if (istrainings) { //title.Less4Zero(); h1_4 = document.InsertParagraph(title.num5title() + "分层分户平面图"); h1_4.StyleName = "Heading5"; using (FontFamily fontfamily = new FontFamily("宋体")) { h1_4.Color(Color.Black).FontSize(14).Font(fontfamily); } } else { title.Less3Zero(); h1_4_1 = document.InsertParagraph(title.num3title() + fm.FCXX_JZMC + "分层分户平面图"); h1_4_1.StyleName = "Heading3"; using (FontFamily fontfamily = new FontFamily("宋体")) { h1_4_1.Color(Color.Black).FontSize(14).Font(fontfamily); } } //房产证 if (p_deed != null) { var tbl_deed = document.InsertParagraph();//房产证表格 Table t_deed = tableHelper.picTable(document, p_deed, "房产证"); t_deed.Alignment = Alignment.center; t_deed.AutoFit = AutoFit.Contents; tbl_deed.InsertTableAfterSelf(t_deed); } //实景图 if (p_virtual != null) { var tbl_virtual = document.InsertParagraph();//实景图表格 Table t_virtual = tableHelper.picTable(document, p_virtual, "房产外墙面实景图"); t_virtual.Alignment = Alignment.center; t_virtual.AutoFit = AutoFit.Contents; tbl_virtual.InsertTableAfterSelf(t_virtual); } //平面图 var title2 = document.InsertParagraph();//生产综合楼分层分户平面图标题 title2.Append("分层分户平面图").FontSize(16); title2.Alignment = Alignment.center; if (lstStr.Count > 0) { Table t = tableHelper.PlanTable(document, companyID, parcelID, fm.FCXX_ID, lstStr); t.Alignment = Alignment.center; t.AutoFit = AutoFit.Window; document.InsertTable(t).Alignment = Alignment.center; } } //if (fm.ZDXX_MC == Parcelname) //{ //} } } catch (System.Exception ex) { LogHelper.WriteLog(typeof(parcelHelper), ex); } }