Ejemplo n.º 1
0
Archivo: ZJDDao.cs Proyecto: YB9527/CG
        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);
        }
Ejemplo n.º 2
0
Archivo: ZJDDao.cs Proyecto: YB9527/CG
        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);
        }