Exemplo n.º 1
0
Arquivo: ZJDDao.cs Projeto: YB9527/CG
        /// <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);
        }
Exemplo n.º 2
0
Arquivo: ZJDDao.cs Projeto: YB9527/CG
        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);
        }
Exemplo n.º 3
0
Arquivo: ZJDDao.cs Projeto: YB9527/CG
        /// <summary>
        /// 检查单个户主
        /// </summary>
        /// <param name="hz"></param>
        private void CheckHZ(JTCY hz, int cellIndex)
        {
            Dictionary <string, string> yhzgxDic = JTCYCustom.YHZGXDic;

            IList <JTCY> jtcys = hz.JTCies;

            foreach (JTCY jtcy in jtcys)
            {
                if (!Utils.CheckIDCard18(jtcy.GMSFHM))
                {
                    CheckZJDWriteError(jtcy.Row, cellIndex, "证件号码不符合规则");
                }
                //检查关系 是否符合规则
                string yhzgx = jtcy.YHZGX;
                if (yhzgx != null && !yhzgxDic.ContainsKey(yhzgx))
                {
                    CheckZJDWriteError(jtcy.Row, cellIndex, yhzgx + ":关系不是标准");
                }
            }
        }