public void ExportZu_ZhiJieRenShenFengZhengMing(JTSYQ jtsyq, string saveDir) { //得到四至涉及单位 /*string str = "510185047009JA00008".Replace("510185",""); * var v = str.Insert(3, "-"); * var v1 = v.Insert(7, "-"); * var v2 = v1.Insert(10, "-");*/ List <XZDM> xzdms = new List <XZDM>(); foreach (JTSYQ tem in jtsyq.GroupJTSYQ) { xzdms.AddRange(JTSYQCustom.GetSZInXZDM(tem)); } //得到行政代码表 foreach (XZDM xzdm in xzdms) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); var doc = WordRead.Read(JTSYQCustom.ZhiJieRenZhengMing); WordWrite.ReplaceText(doc, ClazzDic, xzdm); //查看是村不是组 if (Utils.IsStrNull(xzdm.CunZu)) { WordWrite.SaveToFile(doc, saveDir + "/04指界人身份证明及指界委托书" + xzdm.Cun + ".doc"); } else { WordWrite.SaveToFile(doc, saveDir + "/04指界人身份证明及指界委托书/" + xzdm.CunZu + ".doc"); } } }
public void ExportZu_TuDiQuanShuLaiYuanZhengMing(JTSYQ jtsyq, string saveDir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.JTSYQ_Reflect, true); var doc = WordRead.Read(JTSYQCustom.Zu_TuDiQuanShuLaiYuanZhengMing); WordWrite.ReplaceText(doc, ClazzDic, jtsyq); WordWrite.SaveToFile(doc, saveDir + "/01土地权属来源证明" + jtsyq.XZDM.XiangZheng + jtsyq.XZDM.CunZu + "(" + jtsyq.XZDM.DJZQDM + ").doc"); }
public void ExportZu_FaRenDaiBiaoShenFengZhengMing(XZDM xzdm, string saveDir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); var doc = WordRead.Read(JTSYQCustom.FaRenDaiBiaoShenFengZhengMing); WordWrite.ReplaceText(doc, ClazzDic, xzdm); WordWrite.SaveToFile(doc, saveDir + "/02法人代表身份证明" + xzdm.Zu + ".doc"); }
public void ExportCunYiJianFanKuaiShu(XZDM xzdm, string dir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.FanKuiYiJianShuXMLRelfect, false); var doc = WordRead.Read(JTSYQCustom.FanKuiYiJianShu); WordWrite.ReplaceText(doc, ClazzDic, xzdm); WordWrite.SaveToFile(doc, dir + "//" + System.IO.Path.GetFileName(JTSYQCustom.FanKuiYiJianShu)); }
public void ExportCunDangAnDai(XZDM xzdm, string saveDir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects_get <XZDM>(); var doc = WordRead.Read(JTSYQCustom.CunDangAnDaiTemplete); WordWrite.ReplaceText(doc, ClazzDic, xzdm); WordWrite.SaveToFile(doc, saveDir + "//00档案袋.doc"); }
/// <summary> /// 户主必须是第一个人 /// </summary> /// <param name="jsyd"></param> /// <param name="saveDir"></param> public void ExportZJD_WTS(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.WTSDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); //Dictionary<string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); //WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); IList <JTCY> oneJtcys = jsyd.HZs[0].JTCies; IList <XWPFParagraph> ps = doc.Paragraphs; StringBuilder sb = new StringBuilder(); WordWrite.ReplaceText(ps[3].Runs[0], "孙", ""); //第二段加入户主 WordWrite.SetRun(ps[4].Runs[0], jsyd.HZs[0].XM + "(" + jsyd.HZs[0].GMSFHM + ")", ps[2].Runs[0]); for (int a = 0; a < oneJtcys.Count; a++) { JTCY jtcy = oneJtcys[a]; sb.Append(jtcy.XM + "(" + jtcy.GMSFHM + ")"); if (a < oneJtcys.Count - 1) { sb.Append("、"); } if (a % 2 != 0 && a != 0) { if (a < oneJtcys.Count - 1) { sb.Append("\n\t"); } if (a != 1) { sb.Insert(0, " "); } //两个人就为一行数据 WordWrite.SetRun(ps[3].Runs[0], sb.ToString(), ps[2].Runs[0]); sb.Remove(0, sb.Length); } } if (sb.Length > 0) { sb.Append("\n\t"); if (oneJtcys.Count > 2) { sb.Insert(0, " "); } //第三段加入家庭成员 WordWrite.SetRun(ps[3].Runs[0], sb.ToString(), ps[2].Runs[0]); sb.Remove(0, sb.Length); } string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }
public void ExportCunJieGuo_GongShi(XZDM xzdm, string dir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); var doc = WordRead.Read(JTSYQCustom.JieGuo_GongShi); xzdm.SetZuMiaoShu(); WordWrite.ReplaceText(doc, ClazzDic, xzdm); WordWrite.SaveToFile(doc, dir + "//" + System.IO.Path.GetFileName(JTSYQCustom.JieGuo_GongShi)); }
public void ExportZu_FaRenDaiBiaoWeiTuoShu(XZDM xzdm, string saveDir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); var doc = WordRead.Read(JTSYQCustom.FaRenDaiBiaoWeiTuoShu); WordWrite.ReplaceText(doc, ClazzDic, xzdm); //查看是村不是组 WordWrite.SaveToFile(doc, saveDir + "/03法人代表授权委托书" + xzdm.Zu + ".doc"); }
public void ExportZu_DangAnDai(JTSYQ jtsyq, string saveDir) { Dictionary <string, XMLObject> ClazzDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); var doc = WordRead.Read(JTSYQCustom.Zu_DangAnDai); XZDM xzdm = jtsyq.XZDM; WordWrite.ReplaceText(doc, ClazzDic, xzdm); Dictionary <string, XMLObject> ClazzDic2 = XMLRead.XmlToObjects(JTSYQCustom.JTSYQ_Reflect, true); WordWrite.ReplaceText(doc, ClazzDic2, jtsyq); WordWrite.SaveToFile(doc, saveDir + "/00" + xzdm.XiangZheng + xzdm.CunZu + "(" + xzdm.DJZQDM + ")_1档案袋.doc"); }
public void ExportZu_ShenPiBiao(JTSYQ jtsyq, string saveDir) { //JTSYQCustom.SetContainsFeatureArea(jtsyq); XZDM xzdm = jtsyq.XZDM; Dictionary <string, XMLObject> xzdmDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); var doc = WordRead.Read(JTSYQCustom.ShenPiaoBiao); WordWrite.ReplaceText(doc, xzdmDic, xzdm); Dictionary <string, XMLObject> jtsyqDic = XMLRead.XmlToObjects(JTSYQCustom.JTSYQ_Reflect, true); WordWrite.ReplaceText(doc, jtsyqDic, jtsyq); WordWrite.SaveToFile(doc, saveDir + "/05审批表" + xzdm.Zu + ".doc"); }
/// <summary> /// 生成集体土地所有权证 /// </summary> public void CreateJTTDSYQZ_doc(string excelPath, string saveDir) { if (Utils.CheckFileExists(excelPath) && Utils.CheckDirExists(saveDir)) { List <MyAction> actions = new List <MyAction>(); IList <JTTDSYQZ> jtsyqzs = JTTDSYQZCustom.GetJTTDSYQZS(excelPath); Dictionary <string, XMLObject> xmlObjectDic = XMLRead.XmlToObjects_get <JTTDSYQZ> (); foreach (JTTDSYQZ jtsyqz in jtsyqzs) { Action action = new Action(() => { string th = jtsyqz.TuHao; if (th != null) { string[] array = th.Split('、'); if (array.Length > 2) { jtsyqz.TuHao = array[0] + "、" + array[1]; string th1 = ""; for (int a = 2; a < array.Length; a++) { if (a % 2 == 0) { th1 = th1 + "" + array[a]; } else { th1 = th1 + "、" + array[a]; } } jtsyqz.TH1 = th1; } } XWPFDocument docx = WordRead.Read(JTTDSYQZCustom.DocxTemplete); WordWrite.ReplaceText(docx, xmlObjectDic, jtsyqz); WordWrite.SaveToFile(docx, saveDir + "\\" + jtsyqz.DH + "_" + jtsyqz.DZ.Replace("中江县", "") + ".docx"); }); MyAction myAction = new MyAction(action, jtsyqz.DH + "_" + jtsyqz.DZ.Replace("中江县", "") + ".docx"); actions.Add(myAction); //break; } SingleTaskForm task = new SingleTaskForm(actions, "生成中江档案封面 "); } }
private void ReplaceText_Word(string path) { XWPFDocument doc = WordRead.Read(path); Dictionary <string, IList <RunCustomer> > dic = WordRead.GetDocxDic(doc); foreach (RunCustomer c in dic.Values) { XWPFRun run = c.Run; if ("宗".Equals(run.GetText(0))) { run.SetBold(true); } } WordWrite.SaveToFile(doc, path); }
public void ExportZu_QuanJiDiaoChaBiao(JTSYQ jtsyqGroup, string saveDir) { var doc = WordRead.Read(JTSYQCustom.QuanJiDiaoChaBiao); List <JZD> jzds = new List <JZD>(); int jzdCount = 0; foreach (JTSYQ jtsyq in jtsyqGroup.GroupJTSYQ) { IList <JZD> temp = jtsyq.JZDS; if (Utils.CheckListExists(temp)) { jzdCount += temp.Count; jzds.AddRange(temp); jzds.Add(temp[0]); JZD jzd = new JZD(); jzds.Add(jzd); } else { MessageBox.Show(jtsyq.QLR + ",图上还没有界址点!!!"); return; } } jtsyqGroup.JZDCount = jzdCount; //最后一个空白不要 jzds.RemoveAt(jzds.Count - 1); int jzdEndTableIndex = QuanJiDiaoChaBiaoWriteJZDS(doc, jzds); List <QZB> qzbs = new List <QZB>(); foreach (JTSYQ jtsyq in jtsyqGroup.GroupJTSYQ) { qzbs.AddRange(jtsyq.QZBS); } QuanJiDiaoChaBiaoWriteQZBS(doc, jzdEndTableIndex + 1, qzbs); // JTSYQCustom.SetContainsFeatureArea(jtsyqGroup); XZDM xzdm = jtsyqGroup.XZDM; Dictionary <string, XMLObject> xzdmDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true); WordWrite.ReplaceText(doc, xzdmDic, xzdm); Dictionary <string, XMLObject> jtsyqDic = XMLRead.XmlToObjects(JTSYQCustom.JTSYQ_Reflect, true); WordWrite.ReplaceText(doc, jtsyqDic, jtsyqGroup); WordWrite.SaveToFile(doc, saveDir + "/" + System.IO.Path.GetFileName(JTSYQCustom.QuanJiDiaoChaBiao)); }
/// <summary> /// 写入界址 /// </summary> /// <param name="tbl"></param> /// <param name="jzds"></param> /// <param name="start">界址点下标</param> /// <param name="end"></param> private void WriteJZDSPage(XWPFTable tbl, List <JZD> jzds, int start, int end) { bool isNotLast = true; if (end >= jzds.Count) { isNotLast = false; end = jzds.Count; } int rowIndex = 3; XWPFTableRow row; XWPFTableCell cell; while (start < end) { JZD jzd = jzds[start]; row = tbl.GetRow(rowIndex++); cell = row.GetCell(0); if (jzd.JZDH != 0) { WordWrite.SetCellText(cell, "J" + jzd.JZDH); cell = row.GetCell(4); WordWrite.SetCellText(cell, "√"); } if (start != 0 && jzd.JZDH < jzds[start - 1].JZDH) { rowIndex++; } else { cell = row.GetCell(4); WordWrite.SetCellText(cell, "√"); if (isNotLast || start != jzds.Count - 1) { row = tbl.GetRow(rowIndex++); cell = row.GetCell(7); WordWrite.SetCellText(cell, "√"); cell = row.GetCell(16); WordWrite.SetCellText(cell, "√"); } } start++; } }
/// <summary> /// 写入签章表 /// </summary> /// <param name="tbl"></param> /// <param name="list"></param> /// <param name="start"></param> /// <param name="end"></param> private void WriteQZBPage(XWPFTable tbl, IList <QZB> qzbs, int start, int end) { if (end >= qzbs.Count) { end = qzbs.Count; } int rowIndex = 3; XWPFTableRow row; while (start < end) { QZB qzb = qzbs[start]; row = tbl.GetRow(rowIndex++); WordWrite.SetCellText(row.GetCell(0), "J" + qzb.StartDH); WordWrite.SetCellText(row.GetCell(1), "J" + qzb.EndDH); WordWrite.SetCellText(row.GetCell(2), qzb.MS); start++; } }
public void ExportZJD_SMS(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.SMSDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); Dictionary <string, XMLObject> jsydXML = XMLRead.XmlToObjects(JSYDCustom.JSYDXMLPath); WordWrite.ReplaceText(doc, jsydXML, jsyd); Dictionary <string, XMLObject> xzdmXML = XMLRead.XmlToObjects(JSYDCustom.ZJDXZDMMLPath); WordWrite.ReplaceText(doc, xzdmXML, jsyd.ZJDXZDM); Dictionary <string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); IList <JTCY> jTCies = jsyd.HZs[0].JTCies; StringBuilder sb = new StringBuilder(); for (int a = 0; a < jTCies.Count; a++) { JTCY jtcy = jTCies[a]; if (a % 2 == 0) { sb.Append(jtcy.XM + "(" + jtcy.GMSFHM + ")、"); } else { sb.Append(jtcy.XM + "(" + jtcy.GMSFHM + ")、\r\n"); } } sb.Remove(sb.Length - 1, 1); Dictionary <string, string> replaceDic = new Dictionary <string, string>(); replaceDic.Add("JTCYCount", jsyd.HZs[0].JTCies.Count + ""); replaceDic.Add("Jtcy", sb.ToString()); WordWrite.ReplaceText(doc, replaceDic); string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }
public void ExportZJD_DangAnDai(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.DanAnDaiDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); Dictionary <string, XMLObject> jsydXML = XMLRead.XmlToObjects(JSYDCustom.JSYDXMLPath); WordWrite.ReplaceText(doc, jsydXML, jsyd); Dictionary <string, XMLObject> xzdmXML = XMLRead.XmlToObjects(JSYDCustom.ZJDXZDMMLPath); WordWrite.ReplaceText(doc, xzdmXML, jsyd.ZJDXZDM); Dictionary <string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); Dictionary <string, IList <RunCustomer> > docDic = WordRead.GetDocxDic(doc); IList <RunCustomer> runCustomers; NF nf = jsyd.NFs[0]; //土地证位置是第一个 if (nf.YJTTDSYZ.Equals("遗失/灭失")) { if (docDic.TryGetValue("遗失声明", out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[0]); } if (docDic.TryGetValue("土地登记档案", out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[0]); } } else { if (docDic.TryGetValue(nf.YJTTDSYZ, out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[0]); } } //房屋来源 if (nf.YFWSYQZ.Equals("遗失/灭失")) { if (docDic.TryGetValue("遗失声明", out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[1]); } if (docDic.TryGetValue("房屋登记档案", out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[0]); } } else { if (docDic.TryGetValue(nf.YFWSYQZ, out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[1]); } } //房屋来源 if (docDic.TryGetValue(nf.FWLY, out runCustomers)) { WordWrite.ReplaceSmpbol(runCustomers[0]); } string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }
public void ExportZJD_QJDCB(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.QJDCBDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); //写入界址签章表 IList <QZB> qzbs = jsyd.QZBs; WordWrite.SetTableRowObj(doc, qzbs, JZXInfoCustom.qzbReflect); //写入标示表 IList <JZXInfo> jzxinfos = jsyd.JZXInfos; JZXInfoCustom.CreateBSB(doc, jzxinfos); Dictionary <string, XMLObject> jsydXML = XMLRead.XmlToObjects(JSYDCustom.JSYDXMLPath); WordWrite.ReplaceText(doc, jsydXML, jsyd); Dictionary <string, XMLObject> xzdmXML = XMLRead.XmlToObjects(JSYDCustom.ZJDXZDMMLPath); WordWrite.ReplaceText(doc, xzdmXML, jsyd.ZJDXZDM); Dictionary <string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); Dictionary <string, XMLObject> nfXML = XMLRead.XmlToObjects(JSYDCustom.NFXMLPath); WordWrite.ReplaceText(doc, nfXML, jsyd.NFs[0]); Dictionary <string, string> replaceDic = new Dictionary <string, string>(); replaceDic.Add("Company", "四川旭普信息产业发展有限公司"); string zdnum = jsyd.ZDNUM; replaceDic.Add("Qjbh", zdnum.Substring(6, 3) + "-" + zdnum.Substring(9, 3) + "-" + zdnum.Substring(12, 2) + "-" + zdnum.Substring(14, 5)); //本宗地已取得原土地使用证: 简镇清集用(1990)字第0304 - 37号; 原房屋所有权证: 简农房权字第1002010383号; StringBuilder sb = new StringBuilder(); string str = jsyd.YTDSYZSH; if (!Utils.IsStrNull(str)) { sb.Append("原土地使用证:" + str + ";"); } str = jsyd.NFs[0].SYQZH; if (!Utils.IsStrNull(str)) { sb.Append("原房屋所有权证:" + str + ";"); } if (sb.Length > 0) { sb.Insert(0, "本宗地已取得"); } replaceDic.Add("Tag0", sb.ToString()); WordWrite.ReplaceText(doc, replaceDic); string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }
public void ExportZJD_CHBG(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.CHBGDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); Dictionary <string, XMLObject> xzdmXML = XMLRead.XmlToObjects(JSYDCustom.ZJDXZDMMLPath); WordWrite.ReplaceText(doc, xzdmXML, jsyd.ZJDXZDM); Dictionary <string, XMLObject> jsydXML = XMLRead.XmlToObjects(JSYDCustom.JSYDXMLPath); WordWrite.ReplaceText(doc, jsydXML, jsyd); Dictionary <string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); Dictionary <string, XMLObject> nfXML = XMLRead.XmlToObjects(JSYDCustom.NFXMLPath); WordWrite.ReplaceText(doc, nfXML, jsyd.NFs[0]); Dictionary <string, string> replaceDic = new Dictionary <string, string>(); replaceDic.Add("Company", "四川旭普信息产业发展有限公司"); string zdnum = jsyd.ZDNUM; replaceDic.Add("Qjbh", zdnum.Substring(6, 3) + "-" + zdnum.Substring(9, 3) + "-" + zdnum.Substring(12, 2) + "-" + zdnum.Substring(14, 5)); foreach (NF nf in jsyd.NFs) { if (replaceDic.ContainsKey("JZJG")) { replaceDic["JZJG"] = replaceDic["JZJG"] + "、" + nf.JG; } else { replaceDic.Add("JZJG", nf.JG); } } StringBuilder sb = new StringBuilder(); foreach (Floor f in jsyd.Floors) { sb.Append("S" + f.SZC + " = " + f.CJZMJ + " 平方米 "); } replaceDic.Add("FCMJ", sb.ToString()); XMLTable xmlTable = XMLRead.GetXmlToXMLTabl(JSYDCustom.FloorXMLPath)[0]; XWPFTable table = WordWrite.ReplaceTable_Font <Floor>(doc, xmlTable, jsyd.Floors); int rowX = xmlTable.RowStartIndex + jsyd.Floors.Count; while (table.Rows.Count - rowX > 1) { table.RemoveRow(rowX); } WordWrite.ReplaceText(doc, replaceDic); string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }
/// <summary> /// 创建遗失声明 /// </summary> public void CreateYiShiShengMing() { if (this.YiShengMing.Value) { XWPFDocument doc = WordRead.Read(YiShiModelPath); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("[XM]", PersonZiLiao.Name); dic.Add("[XiangZheng]", XZDM.XiangZheng); dic.Add("[Cun]", XZDM.Cun); dic.Add("[Zu]", XZDM.Zu); if (!Utils.IsStrNull(TuDiZheng)) { RunCustomer runCustomer = new RunCustomer(); runCustomer.Run = doc.Tables[0].Rows[1].GetCell(0).Paragraphs[0].Runs[0]; WordWrite.ReplaceSmpbol(runCustomer); dic.Add("[TuDiZheng]", TuDiZheng); dic.Add("[TuDiZhengYuanQuanLiRen]", TuDiZhengYuanQuanLiRen); dic.Add("[TuDiZhengGuanXi]", TuDiZhengGuanXi); } if (!Utils.IsStrNull(FanChanZheng)) { RunCustomer runCustomer = new RunCustomer(); runCustomer.Run = doc.Tables[0].Rows[2].GetCell(0).Paragraphs[0].Runs[0]; WordWrite.ReplaceSmpbol(runCustomer); dic.Add("[FanChanZheng]", FanChanZheng); dic.Add("[FanChanZhengYuanQuanLiRen]", FanChanZhengYuanQuanLiRen); dic.Add("[FanChanZhengGuanXi]", FanChanZhengGuanXi); } WordWrite.ReplaceText(doc, dic); string saveDir; if (Utils.IsStrNull(PersonZiLiao.ShengMingShu)) { saveDir = PersonZiLiao.DangAnDai.DirClass.DirName; } else { saveDir = PersonZiLiao.ShengMingShu; } WordWrite.SaveToFile(doc, Path.GetDirectoryName(saveDir) + "\\遗失声明书.docx"); } if (this.buYiZhiZhengMing.Value) { XWPFDocument doc = WordRead.Read(BuYiZhiModelPath); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("XM", PersonZiLiao.Name); dic.Add("RenKou", this.PeopleCount); bool flag = false; // 根据原权利人来 //土地证 if (!Utils.IsStrNull(TuDiZhengYuanQuanLiRen)) { flag = true; if (TuDiZhengGuanXi.Contains("本人")) { //第一格 RunCustomer runCustomer = new RunCustomer(); runCustomer.Run = doc.Tables[0].Rows[1].GetCell(0).Paragraphs[0].Runs[0]; WordWrite.ReplaceSmpbol(runCustomer); dic.Add("[T1]", TuDiZhengYuanQuanLiRen); dic.Add("[T2]", ""); dic.Add("[TuDiZhengGuanXi]", ""); } else { RunCustomer runCustomer = new RunCustomer(); runCustomer.Run = doc.Tables[0].Rows[5].GetCell(0).Paragraphs[0].Runs[0]; WordWrite.ReplaceSmpbol(runCustomer); dic.Add("[T1]", ""); dic.Add("[T2]", TuDiZhengYuanQuanLiRen); dic.Add("[TuDiZhengGuanXi]", TuDiZhengGuanXi); } } if (!Utils.IsStrNull(FanChanZhengYuanQuanLiRen)) { flag = true; if (FanChanZhengGuanXi.Contains("本人")) { //第一格 RunCustomer runCustomer = new RunCustomer(); runCustomer.Run = doc.Tables[0].Rows[2].GetCell(0).Paragraphs[0].Runs[0]; WordWrite.ReplaceSmpbol(runCustomer); dic.Add("[F1]", FanChanZhengYuanQuanLiRen); dic.Add("[F2]", ""); dic.Add("[FanChanZhengGuanXi]", ""); } else { RunCustomer runCustomer = new RunCustomer(); runCustomer.Run = doc.Tables[0].Rows[4].GetCell(0).Paragraphs[0].Runs[0]; WordWrite.ReplaceSmpbol(runCustomer); dic.Add("[F1]", ""); dic.Add("[F2]", this.FanChanZhengYuanQuanLiRen); dic.Add("[FanChanZhengGuanXi]", FanChanZhengGuanXi); } } if (flag) { WordWrite.ReplaceText(doc, dic); string saveDir; if (Utils.IsStrNull(PersonZiLiao.ShengMingShu)) { saveDir = PersonZiLiao.DangAnDai.DirClass.DirName; } else { saveDir = PersonZiLiao.ShengMingShu; } WordWrite.SaveToFile(doc, Path.GetDirectoryName(saveDir) + "\\不一致证明.docx"); } } MessageBox.Show("完成"); }
public void ExportZJD_SPB(JSYD jsyd, string saveDir) { string docTempletePath = JSYDCustom.SPBDocPath; XWPFDocument doc = WordRead.Read(docTempletePath); Dictionary <string, XMLObject> jsydXML = XMLRead.XmlToObjects(JSYDCustom.JSYDXMLPath); WordWrite.ReplaceText(doc, jsydXML, jsyd); Dictionary <string, XMLObject> xzdmXML = XMLRead.XmlToObjects(JSYDCustom.ZJDXZDMMLPath); WordWrite.ReplaceText(doc, xzdmXML, jsyd.ZJDXZDM); Dictionary <string, XMLObject> jtcyXML = XMLRead.XmlToObjects(JSYDCustom.JTCYXMLPath); WordWrite.ReplaceText(doc, jtcyXML, jsyd.HZs[0]); Dictionary <string, XMLObject> nfXML = XMLRead.XmlToObjects(JSYDCustom.NFXMLPath); WordWrite.ReplaceText(doc, nfXML, jsyd.NFs[0]); Dictionary <string, string> replaceDic = new Dictionary <string, string>(); replaceDic.Add("JTCYCount", jsyd.HZs[0].JTCies.Count + ""); replaceDic.Add("JTCYs", JTCYCustom.ToStringJTCYs(jsyd.HZs[0])); WordWrite.ReplaceText(doc, replaceDic); //替换符号 Dictionary <String, IList <RunCustomer> > docDic = WordRead.GetDocxDic(doc); IList <RunCustomer> customers; //房屋来源 if (docDic.TryGetValue(jsyd.NFs[0].FWLY, out customers)) { WordWrite.ReplaceSmpbol(customers[0]); } //土地证位置是第一个 if (docDic.TryGetValue(jsyd.NFs[0].YJTTDSYZ, out customers)) { WordWrite.ReplaceSmpbol(customers[0]); } //房产证位置是第二个 if (docDic.TryGetValue(jsyd.NFs[0].YFWSYQZ, out customers)) { WordWrite.ReplaceSmpbol(customers[1]); } if (jsyd.GYFS == "共同共有") { if (docDic.TryGetValue("是", out customers)) { WordWrite.ReplaceSmpbol(customers[1]); } if (docDic.TryGetValue("共同共有", out customers)) { WordWrite.ReplaceSmpbol(customers[0]); } } else { if (docDic.TryGetValue("否", out customers)) { WordWrite.ReplaceSmpbol(customers[1]); } } string saveName = GetZJDSaveFileName(jsyd, saveDir, docTempletePath); WordWrite.SaveToFile(doc, saveName); }