Beispiel #1
0
Datei: JTCY.cs Projekt: YB9527/CG
        public static void ExportJTCYTable(IList <JTCY> hzs, string saveDirPath)
        {
            Dictionary <int, XMLTable> xmlJtcyDkDic = XMLRead.GetXmlToXMLTabl("Model/JTCY.Excel.hbm.xml");
            XMLTable    xmlTable = xmlJtcyDkDic[0];
            IWorkbook   workbook = ExcelRead.ReadExcel("ChengDuGaoXingZaiJiDiModel/家庭成员表模板.xls");
            ISheet      sheet    = workbook.GetSheetAt(0);
            List <JTCY> jtcys    = new List <JTCY>();

            foreach (JTCY hz in hzs)
            {
                jtcys.AddRange(hz.JTCies);
            }
            ExcelWrite.WriteObjects(sheet, xmlTable, jtcys);
            //合并户主的单元格
            int rowIndex = xmlTable.RowStartIndex;

            foreach (JTCY hz in hzs)
            {
                ExcelWrite.SetValue(sheet.GetRow(rowIndex), 0, rowIndex - 4 + "");
                ExcelWrite.SetValue(sheet.GetRow(rowIndex), 1, hz.XM);
                int lastRow = rowIndex + hz.JTCies.Count;
                sheet.AddMergedRegion(new CellRangeAddress(rowIndex, lastRow - 1, 0, 0));
                sheet.AddMergedRegion(new CellRangeAddress(rowIndex, lastRow - 1, 1, 1));
                rowIndex = lastRow;
            }

            ExcelWrite.Save(workbook, saveDirPath + "\\家庭成员表.xls");
        }
Beispiel #2
0
        public static void ExportJSYDTable(IList <JSYD> jsyds, string saveDirPath)
        {
            string jsydExcelPath = "ChengDuGaoXingZaiJiDiModel/建设用地表共用宗模板.xls";
            Dictionary <int, XMLTable> xmlJtcyDkDic = XMLRead.GetXmlToXMLTabl("Model/JSYD.Excel.hbm.xml");
            IWorkbook workbook = ExcelRead.ReadExcel(jsydExcelPath);
            ISheet    sheet    = workbook.GetSheetAt(0);

            ExcelWrite.WriteObjects <JSYD>(sheet, xmlJtcyDkDic[0], jsyds);
            ExcelWrite.Save(workbook, saveDirPath + "\\建设用地表.xls");
        }
Beispiel #3
0
        public void ExportCun_GongShi(IList <JTSYQ> jtsyqs, XZDM xzdm, string dir)
        {
            Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(JTSYQCustom.Cun_GongGao_Reflect);
            XMLTable  xmlTable = ClazzDic[1];
            IWorkbook workbook = ExcelRead.ReadExcel(JTSYQCustom.Cun_GongShi);
            ISheet    sheet    = workbook.GetSheetAt(0);
            //文字替换
            Dictionary <string, XMLObject> xmlobjectDic = XMLRead.XmlToObjects(JTSYQCustom.FanKuiYiJianShuXMLRelfect, false);

            xzdm.JTSYQ_DasTatal = (xzdm.JTSYQ_GSEndTime - xzdm.JTSYQ_GSStartTime).Days;
            ExcelWrite.ReplaceTextByXMLObject(sheet, xzdm, xmlobjectDic);

            //行数据插入
            ExcelWrite.WriteObjects(sheet, xmlTable, jtsyqs);

            ExcelWrite.Save(workbook, dir + "//" + System.IO.Path.GetFileName(JTSYQCustom.Cun_GongShi));
        }
Beispiel #4
0
        public void ExportCun_JiTiTuDiDiaoChaBiao(IList <JTSYQ> jtsyqs, string saveDir)
        {
            Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(JTSYQCustom.JiTiTuDiDiaoChaBiao_Reflect);

            foreach (JTSYQ jtsyq in jtsyqs)
            {
                jtsyq.XZDM = XZDMCustom.GetXzdm(XZDMCustom.JTSYQBianMaToXZDM(jtsyq.BM));
                // JTSYQCustom.SetContainsFeatureArea(jtsyq);
            }

            XMLTable  xmlTable = ClazzDic[1];
            IWorkbook workbook = ExcelRead.ReadExcel(JTSYQCustom.JiTiTuDiDiaoChaBiao);
            ISheet    sheet    = workbook.GetSheetAt(0);

            //行数据插入
            ExcelWrite.WriteObjects(sheet, xmlTable, jtsyqs);
            ExcelWrite.Save(workbook, saveDir + "//" + System.IO.Path.GetFileName(JTSYQCustom.JiTiTuDiDiaoChaBiao));
        }
Beispiel #5
0
        /// <summary>
        /// 导出农房表
        /// </summary>
        /// <param name="nfs"></param>
        /// <param name="saveDirPath"></param>
        public static void ExportNFTable(IList <NF> nfs, string saveDirPath)
        {
            List <NF>    allNF    = new List <NF>();
            List <Floor> allFloor = new List <Floor>();

            foreach (NF nf in nfs)
            {
                //allNF.AddRange(nf.NFS);
                //allFloor.AddRange(nf.Floors);
            }
            Dictionary <int, XMLTable> xmlJtcyDkDic = XMLRead.GetXmlToXMLTabl("Model/NF.Excel.hbm.xml");
            XMLTable  xmlTable = xmlJtcyDkDic[0];
            IWorkbook workbook = ExcelRead.ReadExcel("ChengDuGaoXingZaiJiDiModel/农房表模板.xls");
            ISheet    sheet    = workbook.GetSheetAt(0);

            ExcelWrite.WriteObjects(sheet, xmlTable, allNF);
            //导出分层表
            ExcelWrite.WriteObjects(workbook.GetSheetAt(1), XMLRead.GetXmlToXMLTabl("Model/Floor.Excel.hbm.xml")[0], allFloor);

            ExcelWrite.Save(workbook, saveDirPath + "\\农房表.xls");
        }
Beispiel #6
0
        public void  ExportZu_ZhongDiBiao(JTSYQ jtsyqGroup, string saveDir)
        {
            //   JTSYQCustom.SetContainsFeatureArea(jtsyqGroup);

            Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(JTSYQCustom.DangZhongDi_Reflect);


            XMLTable  xmlTable = ClazzDic[1];
            IWorkbook workbook = ExcelRead.ReadExcel(JTSYQCustom.DangZhongDi);
            ISheet    sheet    = workbook.GetSheetAt(0);

            //行数据插入
            IList <JTSYQ> list = new List <JTSYQ>();

            list.Add(jtsyqGroup);
            double area = jtsyqGroup.Area;

            jtsyqGroup.Area = jtsyqGroup.Area * 10000;
            ExcelWrite.WriteObjects(sheet, xmlTable, list);
            ExcelWrite.Save(workbook, saveDir + "//" + jtsyqGroup.BM + ".xls");
            jtsyqGroup.Area = area;
        }
Beispiel #7
0
        /// <summary>
        /// 导出 农村土地家庭承包农户基本情况信息表(一)
        /// </summary>
        /// <param name="hzs"></param>
        public static bool ExportBsicInformationExcel(IList <JTCY> hzs, string saveDir)
        {
            Dictionary <string, string> dklbDic = new Dictionary <string, string>();

            dklbDic.Add("10", "承包地");
            dklbDic.Add("21", "自留地");
            dklbDic.Add("22", "机动地");
            dklbDic.Add("23", "开荒地");
            dklbDic.Add("99", "其他集体土地");


            if (Utils.IsStrNull(saveDir))
            {
                return(false);
            }
            string basicInformationExxcelTemplete       = System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\农村土地家庭承包农户基本情况信息表(一)模板.xls";
            Dictionary <int, XMLTable>     ClazzDic     = XMLRead.GetXmlToXMLTabl(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteJTCYBaicInformationExcel.xml");
            Dictionary <string, XMLObject> xmlObjectDic = XMLRead.XmlToObjects(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteJTCYBaicInformationExcel.xml");



            string basicInformationExxcelTemplete2       = System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\农村土地承包经营权(家庭承包)台帐(二)模板.xls";
            Dictionary <int, XMLTable>     ClazzDic2     = XMLRead.GetXmlToXMLTabl(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteDKBaicInformationExcel.xml");
            Dictionary <string, XMLObject> xmlObjectDic2 = XMLRead.XmlToObjects(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteDKBaicInformationExcel.xml");


            string cbfbm;

            if (Utils.CheckListExists(hzs))
            {
                DMToText(hzs);
                foreach (JTCY hz in hzs)
                {
                    string cbfdz = hz.DZ;
                    if (!cbfdz.EndsWith("组"))
                    {
                        cbfdz = cbfdz.Substring(0, cbfdz.LastIndexOf("组")) + "组";
                    }
                    int index = cbfdz.IndexOf("镇");
                    if (index == -1)
                    {
                        index = cbfdz.IndexOf("乡");
                    }
                    hz.DZ = cbfdz.Substring(index + 1, cbfdz.Length - index - 1);
                    XMLTable  xmlTable = ClazzDic[0];
                    IWorkbook workbook = ExcelRead.ReadExcel(basicInformationExxcelTemplete);
                    ISheet    sheet    = workbook.GetSheetAt(0);
                    //家庭成员表行数据插入
                    ExcelWrite.WriteObjects(sheet, xmlTable, hz.jTCies);
                    //家庭成员表 文字替换
                    ExcelWrite.ReplaceTextByXMLObject(sheet, hz, xmlObjectDic);
                    ExcelWrite.Save(workbook, saveDir + "//TZ-" + hz.CBFBM.Substring(0, 14) + " " + cbfdz + "\\TZ4 -" + hz.CBFBM + "-1农村土地家庭承包农户基本情况信息表(一).xls");

                    //写地块表
                    Dictionary <string, string> tdlylxDic = ExcelRead.ReadExcelToDic(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\土地利用类型映射表.xlsx", 0);
                    IList <DK> dks = hz.DKs;
                    if (dks == null)
                    {
                        continue;
                    }
                    foreach (DK dk in dks)
                    {
                        if (dk.DKLB == "21")
                        {
                            dk.ZLDMJ = Math.Round(dk.HTMJ, 2).ToString("f2");
                        }
                        else
                        {
                            dk.ELCBMJ = Math.Round(dk.HTMJ, 2).ToString("f2");
                        }


                        string dklb = dk.DKLB;
                        if (dklb != null)
                        {
                            if (dklbDic.TryGetValue(dklb, out dklb))
                            {
                                //地块类别无法识别的情况
                                dk.DKLB = dklb;
                            }
                        }
                        string tdlylx = dk.TDLYLX;
                        if (tdlylx != null)
                        {
                            if (tdlylxDic.TryGetValue(tdlylx, out tdlylx))
                            {
                                dk.TDLYLX = tdlylx;
                            }
                        }
                    }
                    IWorkbook workbook2 = ExcelRead.ReadExcel(basicInformationExxcelTemplete2);
                    ISheet    sheet2    = workbook2.GetSheetAt(0);
                    ExcelWrite.ReplaceTextByXMLObject(sheet2, hz, xmlObjectDic);
                    ExcelWrite.WriteObjects(sheet2, ClazzDic2[0], hz.DKs);


                    for (int a = 0; a < dks.Count; a++)
                    {
                        IRow row = sheet.GetRow(a + 5);
                    }

                    ExcelWrite.Save(workbook2, saveDir + "//TZ-" + hz.CBFBM.Substring(0, 14) + " " + cbfdz + "\\TZ4 -" + hz.CBFBM + "-2农村土地承包经营权(家庭承包)台帐(二).xls");
                }
                return(true);
            }
            return(false);
        }