示例#1
0
文件: JTCY.cs 项目: 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");
        }
示例#2
0
        public void ExportJZDTable(JTSYQ GroupJTSYQ, string dir)
        {
            JTSYQCustom.OrderByJZDH(GroupJTSYQ);

            List <JZD> jzds         = new List <JZD>();
            double     pingFangArea = 0;

            foreach (JTSYQ jtsyq in GroupJTSYQ.GroupJTSYQ)
            {
                pingFangArea += Decimal.ToSingle(decimal.Round(new decimal(jtsyq.Shape_Area), 2));
                IList <JZD> temp = jtsyq.JZDS;
                if (temp == null)
                {
                    return;
                }
                jzds.AddRange(temp);
            }
            double area = GroupJTSYQ.Area;

            GroupJTSYQ.Area = Math.Round(pingFangArea, 2);
            ISheet sheet = JZDCustom.CreateJZDSheet(jzds);

            sheet.Workbook.SetSheetName(0, GroupJTSYQ.BM);

            Dictionary <string, XMLObject> xmlobjectDic = XMLRead.XmlToObjects(JTSYQCustom.JZDXMLRelfect, false);

            ExcelWrite.ReplaceTextByXMLObject(sheet, GroupJTSYQ, xmlobjectDic);

            Dictionary <string, XMLObject> xmlobjectDic2 = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true);

            ExcelWrite.ReplaceTextByXMLObject(sheet, GroupJTSYQ.XZDM, xmlobjectDic2);

            ExcelWrite.Save(sheet.Workbook, dir + "\\06界址点成果表" + GroupJTSYQ.XZDM.Zu + ".xls");
            GroupJTSYQ.Area = area;
        }
示例#3
0
文件: JSYDCustom.cs 项目: YB9527/CG
        public static void SavejSYDRow(JSYD jsyd, ZJDDataSourceViewModel dataSource)
        {
            if (jsyd == null)
            {
                return;
            }


            IList <JTCY> hzs = jsyd.HZs;

            if (hzs != null)
            {
                Dictionary <int, XMLObject> xmlObjectDic = JTCYCustom.GetWriteExcelXMLTable().CellDic;
                foreach (JTCY hz in hzs)
                {
                    foreach (JTCY jtcy in hz.JTCies)
                    {
                        //第三个户主的名称也要更改
                        ICell cell = jtcy.Row.GetCell(1);
                        if (cell != null && cell.CellType == CellType.String)
                        {
                            cell.SetCellValue(hz.XM);
                        }
                        ExcelWrite.WriteRowObject(jtcy, jtcy.Row, xmlObjectDic);
                    }
                }
                UpdateJSYD_HZ(jsyd, hzs[0]);
                ExcelWrite.Save(hzs[0].Row.Sheet.Workbook, dataSource.JTCYTablePath);
            }
            ExcelWrite.WriteRowObject(jsyd, jsyd.Row, GetWriteExcelXMLTable().CellDic);

            ExcelWrite.Save(jsyd.Row.Sheet.Workbook, dataSource.JSYDTablePath);
            //农房表不用保存,分层表保存就行
            IList <NF> nfs = jsyd.NFs;

            if (nfs != null)
            {
                Dictionary <int, XMLObject> xmlObjectDic = NFCustom.GetWriteExcelXMLTable().CellDic;
                foreach (NF nf in nfs)
                {
                    NFCustom.UpdateNF_HZ(nf, hzs[0]);
                    ExcelWrite.WriteRowObject(nf, nf.Row, xmlObjectDic);
                }
            }

            IList <Floor> floors = jsyd.Floors;

            if (floors != null)
            {
                Dictionary <int, XMLObject> xmlObjectDic = FloorCustom.GetWriteExcelXMLTable().CellDic;
                foreach (Floor floor in floors)
                {
                    ExcelWrite.WriteRowObject(floor, floor.Row, xmlObjectDic);
                }
                ExcelWrite.Save(floors[0].Row.Sheet.Workbook, dataSource.NFTablePath);
            }
        }
示例#4
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");
        }
示例#5
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));
        }
示例#6
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));
        }
示例#7
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");
        }
示例#8
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;
        }
示例#9
0
        private void button27_Click(object sender, EventArgs e)
        {
            Document     mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
            DocumentLock documentLock      = mdiActiveDocument.LockDocument();

            try
            {
                string    path     = Utils.CADDir();
                IWorkbook workbook = new JzdService().ZDTExportJzdsExcel();
                if (workbook != null)
                {
                    string text = FileUtils.SaveFileName(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "宗地图界址点个数统计", FileUtils.ExcelFilter);
                    if (text != null)
                    {
                        ExcelWrite.Save(workbook, text);
                    }
                }
            }
            finally
            {
                UserControl1.main.deleteLayerSur("删除");
                documentLock.Dispose();
            }
        }
示例#10
0
        private void button26_Click(object sender, EventArgs e)
        {
            Document     mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
            DocumentLock documentLock      = mdiActiveDocument.LockDocument();

            try
            {
                TypedValue[] types = new TypedValue[]
                {
                    new TypedValue(0, "LWPOLYLINE")
                };
                DBObjectCollection dBObjectCollection = UserControl1.utils.SelectDBObjectCollection("选择需要统计界址点个数的权属线", types);
                if (dBObjectCollection != null && dBObjectCollection.Count != 0)
                {
                    string path = Utils.CADDir();
                    NPOI.SS.UserModel.IWorkbook workbook = new JzdService().ExportJzdsExcel(dBObjectCollection);
                    if (workbook == null)
                    {
                        this.ed.WriteMessage("你没有选择多段线的权属线!!!");
                    }
                    else
                    {
                        string text = FileUtils.SaveFileName(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "地籍图界址点个数统计", FileUtils.ExcelFilter);
                        if (text != null)
                        {
                            ExcelWrite.Save(workbook, text);
                        }
                    }
                }
            }
            finally
            {
                UserControl1.main.deleteLayerSur("删除");
                documentLock.Dispose();
            }
        }
示例#11
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);
        }