Beispiel #1
0
        internal static void ShowTT(string linecode) {
            PS_xl xl = Ebada.Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>(string.Format("where linecode='{0}'", linecode));
            if (xl != null) {
                PJ_17 pj17 = ClientHelper.PlatformSqlMap.GetOneByKey<PJ_17>(xl.LineID);
                DialogResult result = DialogResult.No;
                if (pj17 == null) {
                    pj17 = new PJ_17() { LineCode = xl.LineCode, LineName = xl.LineName, OrgCode = xl.OrgCode, CreateMan = "system" };
                } else {
                    result = MsgBox.ShowAskMessageBox(xl.LineName + "条图已经生成,是否要重新生成。\n生成条图需要几分钟,建议没有修改数据前不要重新生成。\n[确认]重新生成,[取消]打开已生成数据。");
                }
                if (pj17.ID != xl.LineID || result == DialogResult.OK) {
                    setWaitMsg("正在生成“" + xl.LineName + "”条图数据");
                    waitdlg.TopMost = false;
                    Ebada.Client.Platform.MainHelper.Execute("Ebada.Scgl.Yxgl.dll", "Ebada.Scgl.Yxgl.UCPJ_17", "ExportToExcel", new object[] { "高压配电线路条图", "", pj17 });

                    setWaitMsg(null);
                }
                if (pj17.ID == xl.LineID) {
                    if (result == DialogResult.OK)
                        ClientHelper.PlatformSqlMap.Update<PJ_17>(pj17);
                } else {
                    pj17.ID = xl.LineID;
                    ClientHelper.PlatformSqlMap.Create<PJ_17>(pj17);
                }
                object instance = null;

                Ebada.Client.Platform.MainHelper.Execute("Ebada.Scgl.Yxgl.dll", "Ebada.Scgl.Yxgl.frm17Template", "Show", new object[] { pj17 }, null, ref instance);
                Form frm = instance as Form;
                if (frm.ShowDialog() == DialogResult.OK) {
                    object value = instance.GetType().GetProperty("pjobject").GetValue(instance, null);
                    if (value is PJ_17) {
                        ClientHelper.PlatformSqlMap.Update<PJ_17>(value);
                    }
                }

            }
        }
Beispiel #2
0
        private void btReAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (btXlList.EditValue == null|| btXlList.EditValue.ToString()=="" )
            {
                return;
            }
            PS_xl xl= btXlList.EditValue as PS_xl;
            PJ_17 pj = new PJ_17();
            pj.CreateDate = DateTime.Now;
            pj.CreateMan = MainHelper.User.UserName;
            pj.LineName = xl.LineName;
            pj.LineCode = xl.LineCode;
            pj.OrgCode  = xl.OrgCode ;
            pj.OrgName = parentObj.OrgName;
            pj.Remark ="";
            MainHelper.PlatformSqlMap.Create<PJ_17>(pj);
            if (isWorkflowCall)
            {
                WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
                mrwt.ModleRecordID = pj.ID;
                mrwt.RecordID = currRecord.ID;
                mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
                mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
                mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
                mrwt.ModleTableName = pj.GetType().ToString();
                mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
                mrwt.CreatTime = DateTime.Now;
                MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
                MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
            }

            InitData();
            //if (MsgBox.ShowAskMessageBox("是否马上生成条图") == DialogResult.OK)
            {
                
                try
                {
                    if (ExportToExcel("高压配电线路条图", "", pj) < 1) return;

                    frm17Template frm = new frm17Template();
                    frm.pjobject = pj;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        Client.ClientHelper.PlatformSqlMap.Update<PJ_17>(frm.pjobject);
                        //MessageBox.Show("保存成功");
                    }
                }
                catch (Exception ex)
                {
                    MsgBox.ShowException(ex);  

                }
            }
            
        }
Beispiel #3
0
 public void Show(PJ_17 obj) {
     _pjobject = obj;
     //this.Show();
 }
Beispiel #4
0
 void treeViewOperator_AfterAdd(PJ_17 newobj)
 {
     if (AfterAdd != null)
         AfterAdd(treeList1, newobj);
     if (isWorkflowCall)
     {
         WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
         mrwt.ModleRecordID = newobj.ID;
         mrwt.RecordID = currRecord.ID;
         mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString();
         mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString();
         mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString();
         mrwt.ModleTableName = newobj.GetType().ToString();
         mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
         mrwt.CreatTime = DateTime.Now;
         MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
         MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord);
     }
 }
Beispiel #5
0
 void treeViewOperator_CreatingObject(PJ_17 newobj)
 {
     
 }
Beispiel #6
0
 void treeViewOperator_AfterEdit(PJ_17 newobj)
 {
     if (AfterAdd != null)
         AfterEdit(treeList1, newobj);
 }
Beispiel #7
0
        void treeViewOperator_AfterDelete(PJ_17 newobj)
        {
            if (AfterDelete != null)
                AfterDelete(treeList1, newobj);
            if (isWorkflowCall)
            {

                MainHelper.PlatformSqlMap.DeleteByWhere<WF_ModleRecordWorkTaskIns>(" where ModleRecordID='" + newobj.ID + "' and RecordID='" + currRecord.ID + "'"
                    + " and  WorkFlowId='" + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "'"
                    + " and  WorkFlowInsId='" + WorkFlowData.Rows[0]["WorkFlowInsId"].ToString() + "'"
                    + " and  WorkTaskId='" + WorkFlowData.Rows[0]["WorkTaskId"].ToString() + "'"
                    + " and  WorkTaskInsId='" + WorkFlowData.Rows[0]["WorkTaskInsId"].ToString() + "'");
            }
        }
Beispiel #8
0
        //public static int ExportToExcel(string title, string dw,PJ_17 pj17)
        //{
        //    string fname = Application.StartupPath + "\\00记录模板\\17线路条图.xls";
        //    string outfname = Application.StartupPath + "\\17线路条图.xls";
        //    float fxstart = 0,fystart = 0, fwidth = 0,fheight=0;
        //    FpSpread fps = new FpSpread();
        //    FarPoint.Win.Spread.Model.CellRange cr = new FarPoint.Win.Spread.Model.CellRange(2, 2, 12, 12);
        //    FarPoint.Win.LineBorder b = new FarPoint.Win.LineBorder(Color.Black, 1);
        //    FarPoint.Win.LineBorder b2 = new FarPoint.Win.LineBorder(Color.Black, 2);
        //    fps.OpenExcel(fname);
            
        //    SheetView sv = fps.Sheets[0];

        //    PS_xl xl = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineCode='" + pj17.LineCode + "'");
        //    if (xl == null)
        //    {
        //        MsgBox.ShowWarningMessageBox("数据出错,没找到线路");
        //        return -1;
        //    }
        //    int ColumnCount = sv.NonEmptyColumnCount;
        //    int RowCount = sv.NonEmptyRowCount;
        //    int ihang = 0,jlie=0;
        //    int i = 0;
        //    sv.ClearRange(0, 0, RowCount, ColumnCount, false);


        //    //cr = new FarPoint.Win.Spread.Model.CellRange(4, 0, 23, 11);
        //    //sv.SetOutlineBorder(cr, b);


        //    sv.Cells[ihang, jlie].Text = title;
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 22F, System.Drawing.FontStyle.Regular | FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height =40;
        //    sv.Cells[ihang, jlie].ColumnSpan = ColumnCount;

        //    ihang = 1;
        //    sv.Cells[ihang, jlie].Row.Height = 15;
        //    #region 线路名称
        //    ihang = 2;
        //    sv.Cells[ihang, jlie].Text = "线路名称:";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Right;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 1;
        //    sv.Cells[ihang, jlie].Row.Height = 50;

            
            
        //    string str ="";
           
          
        //    string[] strname=new  string[3];
        //    strname[0] = "";
        //    strname[1] = "";
        //    strname[2] = "";
        //    //if (xl.LineName.IndexOf("线") > 0)
        //    //{
        //    //    strname[0] = xl.LineName.Split('线')[0];
        //    //    strname[1] = xl.LineName.Replace(strname[0]+"线","");
                
               
        //    //}
        //    //else
        //    //    strname[1] = xl.LineName;
        //    //if (strname[1].IndexOf("支") > 0)
        //    //{
        //    //    str = strname[1];
        //    //    strname[1] = strname[1].Split('支')[0];
        //    //    strname[2] = str.Replace(strname[1] + "支", "");

        //    //}
        //    //else
        //    //{

        //    //    strname[2] = strname[1];
        //    //    strname[1] = "";
        //    //}
        //    //if (strname[2].IndexOf("分") < 0)
        //    //{
        //    //    if (strname[1] != "")
                
        //    //        strname[1] = strname[1] + "支" + strname[2];
                
        //    //    else
        //    //        strname[0] = strname[0] + "线" + strname[2];
        //    //    strname[2] = "";
        //    //}
        //    //else
        //    //{
        //    //    strname[2] = strname[2].Split('分')[0];

        //    //}
        //    if (xl.LineName.IndexOf("线") > 0)
        //    {
        //        strname[0] = xl.LineName.Split('线')[0];
        //        strname[1] = xl.LineName.Replace(strname[0] + "线", "");


        //    }
        //    else
        //        if (xl.LineName.IndexOf("支") > 0)
        //    {
        //        PS_xl xltemp = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineCode='" + xl.ParentID + "'");
        //        strname[0]=xltemp.LineName;
        //        strname[1] = xl.LineName;
        //    }
        //        else if (xl.LineName.IndexOf("分") > 0)
        //    {
        //        PS_xl xltemp = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineCode='" + xl.ParentID + "'");
        //        if (xltemp != null)
        //        {
        //            strname[1] = xltemp.LineName;
        //            xltemp = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineCode='" + xltemp.ParentID + "'");
        //            if (xltemp != null) strname[0] = xltemp.LineName;
        //        }
        //    }
        //    //if (strname[2].IndexOf("分") < 0)
        //    //{
        //    //    if (strname[1] != "")

        //    //        strname[1] = strname[1] + "支" + strname[2];

        //    //    else
        //    //        strname[0] = strname[0] + "线" + strname[2];
        //    //    strname[2] = "";
        //    //}
        //    //else
        //    //{
        //    //    strname[2] = strname[2].Split('分')[0];

        //    //}
        //    jlie = 1;
        //    sv.Cells[ihang, jlie].Text = strname[0];
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    //sv.Cells[ihang, jlie].ColumnSpan = 3;

        //    jlie ++;
        //    sv.Cells[ihang, jlie].Text = "线";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Left;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Column.Width = 60f;

            
        //    jlie++;
        //    sv.Cells[ihang, jlie].Text = strname[1];
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    //sv.Cells[ihang, jlie].ColumnSpan = 3;

        //    jlie++;
        //    sv.Cells[ihang, jlie].Text = "支";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Left;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Column.Width = 30f;

        //    jlie++;
        //    sv.Cells[ihang, jlie].Text = strname[2];
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    //sv.Cells[ihang, jlie].ColumnSpan = 3;

        //    jlie++;
        //    sv.Cells[ihang, jlie].Text = "分";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Left;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Column.Width = 30f;

        //    jlie ++;
        //    sv.Cells[ihang, jlie].Text = "电压:";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Right;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    //sv.Cells[ihang, jlie].ColumnSpan = 3;
        //    sv.Cells[ihang, jlie].Column.Width = 30f;

        //    jlie++;
        //    sv.Cells[ihang, jlie].Text = xl.LineVol;
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Right;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Column.Width = 30f;

        //    jlie ++;
        //    sv.Cells[ihang, jlie].Text = "kV";
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Right;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Column.Width = 30f;
        //    #endregion

        //    #region 表格外框
        //    ihang =4;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "平";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    sv.Cells[ihang, jlie].Row.Height = 80;
        //    fheight += sv.Cells[ihang, jlie].Row.Height;
        //    //fxstart += sv.Cells[ihang, jlie].Column.Width; 

        //    jlie = 2;
        //    sv.Cells[ihang, jlie].Text = "A 相";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Left;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;

        //    ihang++;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "面";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    sv.Cells[ihang, jlie].Row.Height = 80;
        //    fheight += sv.Cells[ihang, jlie].Row.Height;
            

        //    jlie = 2;
        //    sv.Cells[ihang, jlie].Text = "B 相";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Left;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;

        //    ihang++;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "图";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    sv.Cells[ihang, jlie].Row.Height = 80;
        //    fheight += sv.Cells[ihang, jlie].Row.Height;
           

        //    jlie = 2;
        //    sv.Cells[ihang, jlie].Text = "C 相";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Left;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(4, 0, 3, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    jlie =0;
        //    sv.Cells[ihang, jlie].Text = "杆号";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;

        //    sv.Cells[ihang, jlie].Text = "转角方向";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "杆高(m)";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);
           

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "电杆种类及杆型";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "导线排列方式";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "导线规格";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "档距(m)";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "累计长度(m)";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "横担规格(mm)";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "拉线规格";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].ColumnSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, 0, 1, 2);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "绝缘子";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40; 
        //    sv.Cells[ihang, jlie].RowSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 2, 1);
        //    sv.SetOutlineBorder(cr, b);

        //    jlie = 1;
        //    sv.Cells[ihang, jlie].Text = "规格";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    jlie =1;
        //    sv.Cells[ihang, jlie].Text = "数量";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1,1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "变台";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].RowSpan = 4;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 4, 1);
        //    sv.SetOutlineBorder(cr, b);

        //    jlie = 1;
        //    sv.Cells[ihang, jlie].Text = "型式";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "配变型号";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "台数";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "容量";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "避雷器";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].RowSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 2,1);
        //    sv.SetOutlineBorder(cr, b);

        //    jlie = 1;
        //    sv.Cells[ihang, jlie].Text = "规格";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "数量";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);

        //    ihang++;
        //    jlie = 0;
        //    sv.Cells[ihang, jlie].Text = "开关";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].RowSpan = 2;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 2, 1);
        //    sv.SetOutlineBorder(cr, b);
            

        //    jlie = 1;
        //    sv.Cells[ihang, jlie].Text = "规格";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);


        //    ihang++;
        //    sv.Cells[ihang, jlie].Text = "数量";
        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[ihang, jlie].Row.Height = 40;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, 1);
        //    sv.SetOutlineBorder(cr, b);
        //    #endregion 
        //    #region 填充数据
        //    int istart = 1, iend = 1;
        //    if (xl.LineGtend!="")
        //        istart =Convert.ToInt32(xl.LineGtbegin);
        //    else
        //        istart = 0;
        //    if (xl.LineGtbegin  != "")
        //        iend = Convert.ToInt32(xl.LineGtend);
        //    else
        //        iend = 0;
            
        //    int liespan = 1,lieindex=0,itemp=0,spantemp=0 ;
        //    ihang = 7;
        //    IList<PS_gt> gtlis = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>( " Where LineCode='"+xl.LineCode +"'");
        //    iend = gtlis.Count;
        //    int[] gtwidth = new int[iend];
        //    Hashtable hs = new Hashtable();
            
        //    for (i = 1; i <= iend; i++)
        //    {
        //        //杆塔数
        //        PS_gt gtobj = gtlis[i - 1];
        //        //if (gtobj == null) break ;
                
        //        //绝缘子
        //        IList<PS_gtsb> jyuzlist = Client.ClientHelper.PlatformSqlMap.GetList<PS_gtsb>(" Where sbName='绝缘子' and gtID='" + gtobj.gtID + "'");

        //        //变台
        //        IList<PS_gtsb> btlist = Client.ClientHelper.PlatformSqlMap.GetList<PS_gtsb>(" Where sbName='变台' and gtID='" + gtobj.gtID + "'");

        //        //避雷器
        //        IList<PS_gtsb> blqlist = Client.ClientHelper.PlatformSqlMap.GetList<PS_gtsb>(" Where sbName='避雷器' and gtID='" + gtobj.gtID + "'");

        //        //开关
        //        IList<PS_gtsb> kglist = Client.ClientHelper.PlatformSqlMap.GetList<PS_gtsb>(" Where sbName='开关' and gtID='" + gtobj.gtID + "'");

        //        //导线排列方式
        //        PS_gtsb dxobj = Client.ClientHelper.PlatformSqlMap.GetOne<PS_gtsb>(" Where sbName='导线' and gtID='" + gtobj.gtID + "'");

        //        //横担拉线规格
        //        PS_gtsb hdobj = Client.ClientHelper.PlatformSqlMap.GetOne<PS_gtsb>(" Where sbName='横担' and gtID='" + gtobj.gtID + "'");

        //        //拉线规格
        //        PS_gtsb lxobj = Client.ClientHelper.PlatformSqlMap.GetOne<PS_gtsb>(" Where sbName='拉线' and gtID='" + gtobj.gtID + "'");
        //        liespan = 1;
        //        if (jyuzlist.Count > liespan) liespan = jyuzlist.Count;
        //        if (btlist.Count > liespan) liespan = btlist.Count;
        //        if (blqlist.Count > liespan) liespan = blqlist.Count;
        //        if (kglist.Count > liespan) liespan = kglist.Count;

        //        //杆号
        //        ihang = 7;
        //        jlie = lieindex+2;
        //        sv.Cells[ihang, jlie].Text = i.ToString();
        //        sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //        sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //        sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //转角方向
        //        ihang++;
        //        sv.Cells[ihang, jlie].Text = "";
        //        sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //        sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //        sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //杆高(m)
        //        ihang++;
        //        if (gtobj != null)
        //        {
        //            sv.Cells[ihang, jlie].Text = gtobj.gtHeight.ToString();
        //            sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        }
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);
                

        //        //电杆种类及杆型
        //        ihang++;
        //        if (gtobj != null)
        //        {
        //            if (gtobj.gtType != "" && gtobj.gtModle != "")
        //                sv.Cells[ihang, jlie].Text = gtobj.gtType + "/" + gtobj.gtModle;
        //            else if (gtobj.gtType == "" && gtobj.gtModle != "")
        //                sv.Cells[ihang, jlie].Text = gtobj.gtModle;
        //            else if (gtobj.gtType != "" && gtobj.gtModle == "")
        //                sv.Cells[ihang, jlie].Text = gtobj.gtType;
        //            if (sv.Cells[ihang, jlie].Text == "混凝土拔梢杆/直线杆")
        //            {
        //                sv.Cells[ihang, jlie].Text = "砼/直线杆";
        //            }
        //            else
        //                if (sv.Cells[ihang, jlie].Text.IndexOf( "混凝土")>-1)
        //                {
        //                    sv.Cells[ihang, jlie].Text = "砼";
        //                }

        //        }
        //        sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //        sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //        sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
               
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //导线排列方式
        //        ihang++;

        //        if (dxobj != null)
        //        {
        //            sv.Cells[ihang, jlie].Text = dxobj.C1;
        //            sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        }
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //导线规格
        //        ihang++; 
        //        if (dxobj != null)
        //        {
        //            sv.Cells[ihang, jlie].Text = dxobj.sbModle;
        //            sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        }
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //档距(m)
        //        ihang++;
        //        if (gtobj != null)
        //        {
        //            sv.Cells[ihang, jlie].Text = gtobj.gtSpan.ToString();
        //            sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        }
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //累计长度(m)
        //        ihang++;

        //        //if (xl != null)
        //        //{
        //        //    sv.Cells[ihang, jlie].Text = xl.TotalLength.ToString();
        //        //    sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //        //    sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //        //    sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        //}
        //        //sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        //cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        //sv.SetOutlineBorder(cr, b);

        //        //横担
        //        ihang++;
        //        if (hdobj != null)
        //        {
        //            sv.Cells[ihang, jlie].Text = hdobj.sbModle;
        //            sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        }
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

        //        //拉线规格
        //        ihang++;
        //        if (lxobj != null)
        //        {
        //            sv.Cells[ihang, jlie].Text = lxobj.sbModle;
        //            sv.Cells[ihang, jlie].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie].VerticalAlignment = CellVerticalAlignment.Center;
        //        }
        //        sv.Cells[ihang, jlie].ColumnSpan = liespan;
        //        cr = new FarPoint.Win.Spread.Model.CellRange(ihang, jlie, 1, liespan);
        //        sv.SetOutlineBorder(cr, b);

                
        //        //绝缘子
        //        ihang++;
        //        spantemp = 0;
        //        for (itemp = 0; itemp < jyuzlist.Count; itemp++)
        //        {
        //            sv.Cells[ihang, jlie + itemp].Text = jyuzlist[itemp ].sbModle;
        //            sv.Cells[ihang, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;

                   

        //            sv.Cells[ihang, jlie + itemp].ColumnSpan = 1;
                   
                    

        //            sv.Cells[ihang + 1, jlie + itemp].Text = jyuzlist[itemp].sbNumber.ToString();
        //            sv.Cells[ihang + 1, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang + 1, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang + 1, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            sv.Cells[ihang + 1, jlie + itemp].ColumnSpan = sv.Cells[ihang, jlie + itemp].ColumnSpan;
        //            ////自动行宽30f;
        //            //fps.ActiveSheet.Columns[jlie + itemp].Width = fps.ActiveSheet.Columns[jlie + itemp].GetPreferredWidth();
        //            fps.ActiveSheet.Columns[jlie + itemp].Width = 30f;
        //        }

        //        for (itemp = 0; itemp < sv.Cells[ihang, 0].RowSpan; itemp++)
        //        {
        //            cr = new FarPoint.Win.Spread.Model.CellRange(ihang + itemp, jlie, 1, liespan);
        //            sv.SetOutlineBorder(cr, b);
        //        }
        //        if (!hs.ContainsKey(gtobj.gtID))
        //            hs.Add(gtobj.gtID, 0);
        //        else
        //            hs[gtobj.gtID] = 0;
                
        //        //变台
        //        ihang += sv.Cells[ihang, 0].RowSpan;
        //        for (itemp = 0; itemp < btlist.Count; itemp++)
        //        {
        //            sv.Cells[ihang, jlie + itemp].Text = btlist[itemp].sbType ;
        //            sv.Cells[ihang, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            sv.Cells[ihang, jlie + itemp].ColumnSpan = 1;
        //            if (btlist[itemp].sbType == "H台")
        //            {
        //                sv.Cells[4, jlie + itemp].Text = gtobj.gtCode;  
        //                if (!hs.ContainsKey(gtobj.gtID))
        //                    hs.Add(gtobj.gtID, 1);
        //                else
        //                    hs[gtobj.gtID] = 1;
        //            }
                    


        //            sv.Cells[ihang + 1, jlie + itemp].Text = btlist[itemp].sbModle;
        //            sv.Cells[ihang + 1, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang + 1, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang + 1, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            sv.Cells[ihang + 1, jlie + itemp].ColumnSpan = sv.Cells[ihang+1, jlie + itemp].ColumnSpan;

        //            sv.Cells[ihang + 2, jlie + itemp].Text = btlist[itemp].sbNumber.ToString () ;
        //            sv.Cells[ihang + 2, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang + 2, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang + 2, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            sv.Cells[ihang + 2, jlie + itemp].ColumnSpan = sv.Cells[ihang+2, jlie + itemp].ColumnSpan;

        //            sv.Cells[ihang + 3, jlie + itemp].Text = btlist[itemp].C1 ;
        //            sv.Cells[ihang + 3, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang + 3, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang + 3, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            sv.Cells[ihang + 3, jlie + itemp].ColumnSpan = sv.Cells[ihang+3, jlie + itemp].ColumnSpan;
        //            ////自动行宽
        //            //fps.ActiveSheet.Columns[jlie + itemp].Width = fps.ActiveSheet.Columns[jlie + itemp].GetPreferredWidth();
        //            fps.ActiveSheet.Columns[jlie + itemp].Width = 30f;
                   
        //        }
        //        for (itemp = 0; itemp < sv.Cells[ihang, 0].RowSpan; itemp++)
        //        {
                    
        //            cr = new FarPoint.Win.Spread.Model.CellRange(ihang + itemp, jlie, 1, liespan);
        //            sv.SetOutlineBorder(cr, b);
        //        }
                

        //        //避雷器
        //        ihang += sv.Cells[ihang, 0].RowSpan;
        //        for (itemp = 0; itemp < blqlist.Count; itemp++)
        //        {
        //            sv.Cells[ihang, jlie + itemp].Text = blqlist[itemp].sbModle;
        //            sv.Cells[ihang, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;

        //            sv.Cells[ihang, jlie + itemp].ColumnSpan = 1;

                   


        //            sv.Cells[ihang + 1, jlie + itemp].Text = blqlist[itemp].sbNumber.ToString();
        //            sv.Cells[ihang + 1, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang + 1, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang + 1, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            //sv.Cells[ihang + 1, jlie + itemp].Column.Width = 80;
        //            sv.Cells[ihang + 1, jlie + itemp].ColumnSpan = sv.Cells[ihang, jlie + itemp].ColumnSpan;
        //            ////自动行宽
        //            //fps.ActiveSheet.Columns[jlie + itemp].Width = fps.ActiveSheet.Columns[i].GetPreferredWidth();
        //            fps.ActiveSheet.Columns[jlie + itemp].Width = 30f;
        //        }

        //        for (itemp = 0; itemp < sv.Cells[ihang, 0].RowSpan; itemp++)
        //        {
        //            cr = new FarPoint.Win.Spread.Model.CellRange(ihang + itemp, jlie, 1, liespan);
        //            sv.SetOutlineBorder(cr, b);
        //        }

        //        //开关
        //        ihang += sv.Cells[ihang, 0].RowSpan;
        //        for (itemp = 0; itemp < kglist.Count; itemp++)
        //        {
        //            sv.Cells[ihang, jlie + itemp].Text = kglist[itemp].sbModle;
        //            sv.Cells[ihang, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;

        //            sv.Cells[ihang, jlie + itemp].ColumnSpan = 1;

                    


        //            sv.Cells[ihang + 1, jlie + itemp].Text = kglist[itemp].sbNumber.ToString();
        //            sv.Cells[ihang + 1, jlie + itemp].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //            sv.Cells[ihang + 1, jlie + itemp].HorizontalAlignment = CellHorizontalAlignment.Center;
        //            sv.Cells[ihang + 1, jlie + itemp].VerticalAlignment = CellVerticalAlignment.Center;
        //            //sv.Cells[ihang + 1, jlie + itemp].Column.Width = 80;
        //            sv.Cells[ihang + 1, jlie + itemp].ColumnSpan = sv.Cells[ihang+1, jlie + itemp].ColumnSpan;
        //            ////自动行宽
        //            //fps.ActiveSheet.Columns[jlie + itemp].Width = fps.ActiveSheet.Columns[i].GetPreferredWidth();
        //            fps.ActiveSheet.Columns[jlie + itemp].Width = 30f;
        //        }

        //        for (itemp = 0; itemp < sv.Cells[ihang, 0].RowSpan; itemp++)
        //        {
        //            cr = new FarPoint.Win.Spread.Model.CellRange(ihang + itemp, jlie, 1, liespan);
        //            sv.SetOutlineBorder(cr, b);
        //        }


        //        ////自动行宽
        //        //fps.ActiveSheet.Columns[jlie].Width = fps.ActiveSheet.Columns[jlie].GetPreferredWidth();
        //        fps.ActiveSheet.Columns[jlie + itemp].Width = 30f;
        //        lieindex += liespan;
        //        fwidth += fps.ActiveSheet.Columns[jlie].Width;
        //        //for (itemp = 0; itemp < sv.Cells[8, jlie].ColumnSpan; itemp++)
        //        //    gtwidth[i - 1] += sv.Cells[ihang, jlie + itemp].Column.Width;
        //        gtwidth[i - 1] = liespan;
        //    }

        //    cr = new FarPoint.Win.Spread.Model.CellRange(4, 2, 3, lieindex);
        //    sv.SetOutlineBorder(cr, b);
        //    //累计长度(m)
        //    sv.Cells[14, 2].Text = xl.TotalLength.ToString();
        //    sv.Cells[14, 2].Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
        //    sv.Cells[14, 2].HorizontalAlignment = CellHorizontalAlignment.Center;
        //    sv.Cells[14, 2].VerticalAlignment = CellVerticalAlignment.Center;
        //    sv.Cells[14, 2].ColumnSpan = lieindex;
        //    cr = new FarPoint.Win.Spread.Model.CellRange(14, 2, 1, lieindex);
        //    sv.SetOutlineBorder(cr, b);
        //    ihang += sv.Cells[ihang, 0].RowSpan;
        //    fystart = 0;
        //    for (itemp = 0; itemp <=4; itemp++)
        //    {
        //        if(itemp <4)
        //        fystart += sv.Cells[itemp, 0].Row.Height;
        //        else
        //            fystart += sv.Cells[itemp, 0].Row.Height/2;
        //    }

        //    #endregion
        //    ColumnCount = sv.NonEmptyColumnCount;
        //    RowCount = sv.NonEmptyRowCount;
        //    sv.Cells[0, 0].ColumnSpan = ColumnCount;
        //    fps.SaveExcel(outfname);
        //    #region 画图形
        //    DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl();
        //    dsoFramerWordControl1.FileOpen(outfname);
        //     Microsoft.Office.Interop.Excel.Workbook wb;
        //     Microsoft.Office.Interop.Excel.Worksheet xx;
        //     try {
        //         wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook;
        //         xx = wb.Application.Sheets[1] as Microsoft.Office.Interop.Excel.Worksheet;

        //     } catch (Exception err) {
        //         dsoFramerWordControl1.FileClose();
        //         throw new Exception("excel的打开方式不对,有可能装有wps", err);
        //     }
        //    Excel.Range range;
        //    if (lieindex < 1)
        //        range = (Excel.Range)xx.get_Range(xx.Cells[5, 1], xx.Cells[RowCount , ColumnCount]);
        //    else
        //        range = (Excel.Range)xx.get_Range(xx.Cells[5, 1], xx.Cells[RowCount, lieindex + 2]);

        //    range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous;
        //    range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop].Weight = Excel.XlBorderWeight.xlThick;
        //    range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeRight ].LineStyle = Excel.XlLineStyle.xlContinuous;
        //    range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeRight].Weight = Excel.XlBorderWeight.xlThick;
        //    range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom ].LineStyle = Excel.XlLineStyle.xlContinuous;
        //    range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom].Weight = Excel.XlBorderWeight.xlThick;

        //    float gwidth = 13.50F, gheifht = 15.75F;
        //    Microsoft.Office.Interop.Excel.Shape activShape,oldShape=null;
        //    int icolor = (int)(((uint)Color.White.B << 16) | (ushort)(((ushort)Color.White.G << 8) | Color.White.R));
        //    i =3;

        //    range = (Excel.Range)xx.get_Range(xx.Cells[6, 1], xx.Cells[6,2]);
        //    fxstart = (float)Convert.ToDouble(range.Cells.Width);
        //    for (itemp = 0; itemp < gtlis.Count; itemp++)
        //    {

        //        range = (Excel.Range)xx.get_Range(xx.Cells[8, i], xx.Cells[8, i + gtwidth[itemp] - 1]);
        //        float width = (float)Convert.ToDouble(range.Cells.Width);
        //        if (hs[gtlis[itemp].gtID].ToString() == "1")
        //        {
        //            activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart - gwidth + width / 2, fystart, gwidth, gheifht);
        //            //activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart, fystart, gwidth, gheifht);
        //            activShape.Fill.ForeColor.RGB = icolor;
        //            if (itemp > 0)
        //            {
        //                //Texture Image Recognition Algorithm Based on Steerable Pyramid Transform

        //                xx.Shapes.AddLine(oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2, activShape.Left, activShape.Top + activShape.Height / 2);

        //            }
        //            activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, activShape.Left + activShape.Width, fystart, gwidth, gheifht);
        //            activShape.Fill.ForeColor.RGB = icolor;
                    
        //        }
        //        else
        //        {
        //            activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart + width / 2, fystart, gwidth, gheifht);
        //            //activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart, fystart, gwidth, gheifht);
        //            activShape.Fill.ForeColor.RGB = icolor;
        //            if (itemp > 0)
        //            {
        //                //Texture Image Recognition Algorithm Based on Steerable Pyramid Transform

        //                xx.Shapes.AddLine(oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2, activShape.Left, activShape.Top + activShape.Height / 2);

        //            }
        //        }

        //        //fxstart += gtwidth[itemp];
        //        fxstart += width;  
        //        i += gtwidth[itemp];
        //        oldShape = activShape;
        //    }
        //    dsoFramerWordControl1.FileSave();
        //    pj17.BigData = dsoFramerWordControl1.FileDataGzip; 
        //    dsoFramerWordControl1.FileClose(); 
        //    dsoFramerWordControl1.Dispose();
        //    #endregion
        //    //System.Diagnostics.Process.Start(outfname);
        //    return 1;
        //}


        public static int ExportToExcel(string title, string dw, PJ_17 pj17) {
            string fname = Application.StartupPath + "\\00记录模板\\17线路条图2.xls";
            float fxstart = 0, fystart = 0, fwidth = 0, fheight = 0;
            DSOFramerControl dsoFramerWordControl1 = new DSOFramerControl();
            string outfname = Path.GetTempFileName() + ".xls";
            File.Copy(fname, outfname);
            dsoFramerWordControl1.FileOpen(outfname);
            Microsoft.Office.Interop.Excel.Worksheet xx;
            Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
            ExcelAccess ex = new ExcelAccess();
            ex.MyWorkBook = wb;
            ex.MyExcel = wb.Application;
            PS_xl xl = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineCode='" + pj17.LineCode + "'");
            try {
                if (xl == null) {
                    MsgBox.ShowWarningMessageBox("数据出错,没找到线路");
                    return -1;
                }
                string strLinexh = xl.WireType;//导线型号
                PS_gt gtformer = null;
                IList<PS_gt> gtlis = Client.ClientHelper.PlatformSqlMap.GetList<PS_gt>(" Where LineCode='" + xl.LineCode + "' order by gtcode");
                gtformer = Client.ClientHelper.PlatformSqlMap.GetOne<PS_gt>(" Where gtID='" + xl.ParentGT + "'");
                gtlis.Insert(0, gtformer);
                //计算页码
                int pagecount = 1, jmax = 15, m = 0, j = 0;
                pagecount = gtlis.Count / 15 + 1;
                int ihang = 8, jlie = 2;
                int i = 0;
                //复制空模板
                for (m = 1; m < pagecount; m++) {
                    ex.CopySheet(1, m);
                    ex.ReNameWorkSheet(m + 1, "Sheet" + (m + 1));
                }
                string[] strname = new string[3];
                strname[0] = "";
                strname[1] = "";
                strname[2] = "";

                if (xl.LineType == "1") {
                    strname[0] = xl.LineName.Split('线')[0] + "线";
                    strname[1] = xl.LineName.Replace(strname[0], "");


                } else
                    if (xl.LineType == "2") {
                        PS_xl xltemp = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineID='" + xl.ParentID + "'");
                        if (xltemp != null)
                            strname[0] = xltemp.LineName;
                        strname[1] = xl.LineName.Replace(xltemp.LineName, "");
                    } else if (xl.LineType == "3") {
                        strname[2] = xl.LineName;
                        PS_xl xltemp = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineID='" + xl.ParentID + "'");
                        if (xltemp != null) {
                            strname[1] = xltemp.LineName;
                            xltemp = MainHelper.PlatformSqlMap.GetOne<PS_xl>(" where LineID='" + xltemp.ParentID + "'");
                            if (xltemp != null) strname[0] = xltemp.LineName;
                        }
                        strname[2].Replace(strname[1], "");
                        strname[1].Replace(strname[0], "");
                    }
                //填写公共项
                for (m = 1; m <= pagecount; m++) {
                    ex.ActiveSheet("Sheet" + m);
                    ex.SetCellValue(strname[0], 3, 2);
                    ex.SetCellValue(strname[1], 3, 5);
                    ex.SetCellValue(strname[2], 3, 11);
                    ex.SetCellValue(xl.LineVol.ToString(), 3, 20);

                }
                ihang = 8;
                jlie = 3;
                int hdRowCount = 1;
                int jyzRowCount = 1;
                int dxRowCount = 1;
                int btRowCount = 1;
                int blqRowCount = 1;
                int kgRowCount = 1;
                int lxRowCount = 1;
                int jstart = 3;
                double dc = 0;
                string strfx = "";
                Excel.Range range;
                for (i = 1; i < gtlis.Count; i++) {
                    if ((i + 0.0) % (jmax) == 1) {

                        jlie = 3;
                        ihang = 8;
                        hdRowCount = 1;
                        jyzRowCount = 1;
                        dxRowCount = 1;
                        btRowCount = 1;
                        blqRowCount = 1;
                        kgRowCount = 1;
                        lxRowCount = 1;

                    }
                    if (Math.Ceiling((i + 0.0) / (jmax)) > 1) {
                        ex.ActiveSheet("Sheet" + Math.Ceiling((i + 0.0) / (jmax)));
                        xx = wb.Application.Sheets["Sheet" + Math.Ceiling((i + 0.0) / (jmax))] as Microsoft.Office.Interop.Excel.Worksheet;


                    } else {
                        ex.ActiveSheet("Sheet1");
                        xx = wb.Application.Sheets["Sheet1"] as Microsoft.Office.Interop.Excel.Worksheet;
                    }

                    //ex.SetCellValue(i.ToString(), ihang, jlie);

                    ////杆塔数
                    PS_gt gtobj = gtlis[i];
                    //if (gtobj == null)
                    //{
                    //    if ((i + 0.0) % (jmax) == 0&&i>1)
                    //    {
                    //        //累计长度
                    //        double sum = 0;
                    //        for (int item = i; item < i + 15 && item < gtlis.Count; item++)
                    //        {
                    //            PS_gt gttemp = gtlis[item];
                    //            if (gttemp != null)
                    //            {
                    //                sum += Convert.ToDouble(gttemp.gtSpan);
                    //            }
                    //        }
                    //        ex.SetCellValue(sum.ToString(), ihang, 2);
                    //    }
                    //    jlie += 2;
                    //    continue;

                    //}
                    //绝缘子
                    string strSQL = "select distinct sbModle from PS_gtsb Where  gtID='" + gtobj.gtID + "' ";
                    if (xl.LineVol != "" && Convert.ToDouble(xl.LineVol) >= 10) {
                        strSQL += "  and (sbName like '高压%立瓶%' or sbName like '高压%悬垂%' or sbName like '高压%茶台%' )";
                    } else
                        if (xl.LineVol != "" && 0.4 >= Convert.ToDouble(xl.LineVol)) {
                            strSQL += "  and (sbName like '低压%立瓶%'  or sbName like '低压%茶台%' )";
                        }

                    IList jyuzlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", strSQL);

                    //变台
                    //IList btlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct sbModle from PS_gtsb Where sbName like '%变压器%' and gtID='" + gtobj.gtID + "'");
                    IList btlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct bttype from PS_tq Where   gtID='" + gtobj.gtID + "'");

                    //避雷器
                    IList blqlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct sbModle from PS_gtsb Where sbName='避雷器' and gtID='" + gtobj.gtID + "'");

                    //开关
                    IList kglist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct kgModle from PS_kg Where gtID='" + gtobj.gtID + "'");

                    //导线型号
                    IList dxlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct sbModle from PS_gtsb  Where sbName like '%导线%' and gtID='" + gtobj.gtID + "'");
                    //导线排列方式
                    IList dxpllist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct C1 from PS_gtsb  Where sbName like '%导线%' and gtID='" + gtobj.gtID + "'");

                    //横担规格
                    IList hdobj = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct sbModle from PS_gtsb Where sbName like '%横担%' and gtID='" + gtobj.gtID + "'");

                    //拉线规格
                    IList lxlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", " select distinct sbModle from PS_gtsb  Where sbName like '%拉线%' and gtID='" + gtobj.gtID + "'");

                    IList ilisttemp = null;


                    ihang = 8;
                    ////杆号
                    ex.SetCellValue((i).ToString(), ihang, jlie);
                    ihang++;

                    //转角方向
                    if (gtobj.gtModle.IndexOf("转角") > -1) {
                        if (i != 1 && i < gtlis.Count - 1) {


                            decimal[,] a1 = new decimal[1, 2];
                            decimal[,] a2 = new decimal[1, 2];
                            a1[0, 0] = gtlis[i].gtLat - gtlis[i - 1].gtLat;
                            a1[0, 1] = gtlis[i].gtLon - gtlis[i - 1].gtLon;

                            a2[0, 0] = gtlis[i + 1].gtLat - gtlis[i].gtLat;
                            a2[0, 1] = gtlis[i + 1].gtLon - gtlis[i].gtLon;
                            decimal di = a1[0, 0] * a2[0, 0] + a1[0, 1] * a2[0, 1];
                            double dl = Math.Sqrt(Convert.ToDouble(a1[0, 0] * a1[0, 0] + a1[0, 1] * a1[0, 1]) * Math.Sqrt(Convert.ToDouble(
                                a2[0, 0] * a2[0, 0] + a2[0, 1] * a2[0, 1])));
                            dc = Math.Round(180 * Math.Acos(Convert.ToDouble(di) / Convert.ToDouble(dl)) / 3.1415926, 0);
                            if (gtlis[i].gtLon > gtlis[i - 1].gtLon) {
                                strfx = "右转";
                            } else {
                                strfx = "左转";
                            }
                            if (dc.ToString() != "NaN" && dc.ToString() != "非数字")
                                ex.SetCellValue(strfx + dc + "度", ihang, jlie);
                            else {

                            }
                        }

                    }
                    ihang++;

                    //杆高(m)
                    if (gtobj != null) {

                        ex.SetCellValue(gtobj.gtHeight.ToString(), ihang, jlie);

                    }
                    ihang++;

                    //电杆种类/杆型
                    if (gtobj != null) {
                        string strtype = "", strzj = "";
                        if (gtobj.gtType.IndexOf("混凝土拔梢杆") > -1) {
                            strtype = "砼";
                        }
                        if (gtobj.gtModle.IndexOf("直线杆") > -1) {
                            strzj = "直";
                        } else if (gtobj.gtModle.IndexOf("分支杆") > -1) {
                            strzj = "分";
                        } else if (gtobj.gtModle.IndexOf("转角杆") > -1) {
                            strzj = "转";
                        } else if (gtobj.gtModle.IndexOf("耐张杆") > -1) {
                            strzj = "耐";
                        } else if (gtobj.gtModle.IndexOf("终端杆") > -1) {
                            strzj = "终";
                        }

                        if (strtype != "" && strzj != "") {
                            ex.SetCellValue(strtype + "/" + strzj, ihang, jlie);
                        } else {
                            ex.SetCellValue(gtobj.gtType + "/" + gtobj.gtModle, ihang, jlie);
                        }
                    }
                    ihang++;
                    //导线排列方式

                    if (hdobj.Count > 0 && hdobj[0].ToString().Contains("三角")) {

                        ex.SetCellValue("三角排列", ihang, jlie);
                    } else {
                        ex.SetCellValue("水平排列", ihang, jlie);
                    }
                    /*
                    if (((i + 0.0) % (jmax) == 0 && i > 1) || i == gtlis.Count) {
                        //合并同类项
                        string stplrname = "";
                        int ista = i, item = i, jlietemp = jlie;
                        for (item = i; item > 1; item--) {
                            PS_gt gttemp = gtlis[item - 1];
                            PS_gt gttemp2 = gtlis[item - 2];
                            IList dxpllist2 = null;
                            IList dxpllist3 = null;
                            string str1 = "", str2 = "";
                            if (gttemp != null) {
                                dxpllist2 = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                                    "select distinct sbName from PS_gtsb  Where sbName like '%横担%' and gtID='" + gttemp.gtID + "'");
                                if (dxpllist2.Count > 0) str1 = dxpllist2[0].ToString();
                            }
                            if (gttemp2 != null) {
                                dxpllist3 = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                                    "select distinct sbName from PS_gtsb  Where sbName like '%横担%' and gtID='" + gttemp2.gtID + "'");
                                if (dxpllist3.Count > 0) str2 = dxpllist3[0].ToString();
                            }

                            if (gttemp2 == null || str2 == str1) {
                                if (jlietemp > 4) {
                                    range = (Excel.Range)xx.get_Range(xx.Cells[ihang, jlietemp], xx.Cells[ihang, jlietemp - 2]);
                                    range.Merge(Type.Missing);
                                    if ((item % jmax == 2 && ista != item) || jlietemp == 5) {
                                        if (str1 != "" && str1.Contains("三角"))
                                        {                                          
                                            ex.SetCellValue("角排列", ihang, jlietemp - 2);
                                        }
                                        else
                                        {
                                            ex.SetCellValue("水平排列", ihang, jlietemp - 2);
                                        }

                                    }
                                }
                            } else {
                                if (str1 != "" && str1.Contains("三角"))
                                {
                                    ex.SetCellValue("角排列", ihang, jlietemp);
                                }
                                else
                                {
                                    ex.SetCellValue("水平排列", ihang, jlietemp);
                                }                               
                            }
                            jlietemp = jlietemp - 2;
                            if (item % jmax == 2 && ista != item) {
                                break;
                            }

                        }
                    }
                    else
                    {
                        if (gtlis.Count>0)
                        {
                            string stplrname = "";
                            int ista = i, item = i, jlietemp = jlie;
                            for (item = i; item > 1; item--)
                            {
                                PS_gt gttemp = gtlis[item - 1];
                                PS_gt gttemp2 = gtlis[item - 2];
                                IList dxpllist2 = null;
                                IList dxpllist3 = null;
                                string str1 = "", str2 = "";
                                if (gttemp != null)
                                {
                                    dxpllist2 = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                                        "select distinct sbName from PS_gtsb  Where sbName like '%横担%' and gtID='" + gttemp.gtID + "'");
                                    if (dxpllist2.Count > 0) str1 = dxpllist2[0].ToString();
                                }
                                if (gttemp2 != null)
                                {
                                    dxpllist3 = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                                        "select distinct sbName from PS_gtsb  Where sbName like '%横担%' and gtID='" + gttemp2.gtID + "'");
                                    if (dxpllist3.Count > 0) str2 = dxpllist3[0].ToString();
                                }

                                if (gttemp2 == null || str2 == str1)
                                {
                                    if (jlietemp > 4)
                                    {
                                        range = (Excel.Range)xx.get_Range(xx.Cells[ihang, jlietemp], xx.Cells[ihang, jlietemp - 2]);
                                        range.Merge(Type.Missing);
                                        if ((item % jmax == 2 && ista != item) || jlietemp == 5)
                                        {
                                            if (str1 != "" && str1.Contains("三角"))
                                            {
                                                ex.SetCellValue("角排列", ihang, jlietemp - 2);
                                            }
                                            else
                                            {
                                                ex.SetCellValue("水平排列", ihang, jlietemp - 2);
                                            }

                                        }
                                    }
                                }
                                else
                                {
                                    if (str1 != "" && str1.Contains("三角"))
                                    {
                                        ex.SetCellValue("角排列", ihang, jlietemp);
                                    }
                                    else
                                    {
                                        ex.SetCellValue("水平排列", ihang, jlietemp);
                                    }
                                }
                                jlietemp = jlietemp - 2;
                                if (item % jmax == 2 && ista != item)
                                {
                                    break;
                                }

                            }
                        }
                    }
                    */
                    ihang++;
                    //导线型号规格(mm2)
                    if (dxlist != null && dxlist.Count > 0) {
                        if (dxlist.Count > dxRowCount) {
                            for (j = dxRowCount; j < dxlist.Count; j++) {
                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + dxRowCount, "A"], xx.Cells[ihang + dxRowCount, "A"]);
                                range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing);

                            }
                            for (int jtem = 1; jtem < dxlist.Count; jtem++) {
                                for (int item = 0; item < 29; item += 2) {
                                    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jtem, jstart + item], xx.Cells[ihang + jtem, jstart + 1 + item]);
                                    range.Merge(Type.Missing);
                                }
                            }
                            dxRowCount = dxlist.Count;
                            range = (Excel.Range)xx.get_Range(xx.Cells[ihang, 1], xx.Cells[ihang + dxRowCount - 1, 1]);
                            range.Merge(Type.Missing);
                        }
                        if (dxlist.Count > 0) {

                            for (j = 0; j < dxlist.Count; j++)
                                ex.SetCellValue(dxlist[j].ToString(), ihang + j, jlie);
                        }

                    } else {
                        ex.SetCellValue(strLinexh, ihang, jlie);
                    }

                    ihang += dxRowCount;
                    if (i == 15) {
                        int nn = 0;
                    }
                    //档        距(m)
                    if (gtobj != null && gtobj.gtSpan > 0) {
                        if (jlie > 3)
                            ex.SetCellValue(gtobj.gtSpan.ToString(), ihang, jlie - 1);
                        else
                            ex.SetCellValue(gtobj.gtSpan.ToString(), ihang, jlie);
                    }
                    ihang++;
                    //累计长度


                    if (((i + 0.0) % (jmax) == 0 && i > 1) || i == gtlis.Count - 1) {
                        //累计长度
                        double sum = 0;
                        int ista = i, item = i;
                        for (item = i; item > 0; item--) {
                            PS_gt gttemp = gtlis[item];
                            if (gttemp != null) {
                                sum += Convert.ToDouble(gttemp.gtSpan);
                            }
                            if (i < gtlis.Count - 1) {
                                if (item % jmax == 1 && ista != item) {
                                    break;
                                }
                            } else {
                                if (item % jmax == 1) {
                                    break;
                                }
                            }
                        }
                        sum = 0;
                        for (int m1 = 0; m1 < gtlis.Count; m1++) {
                            PS_gt gttemp = gtlis[m1];
                            if (gttemp != null) {
                                sum += Convert.ToDouble(gttemp.gtSpan);
                            }
                        }
                        ex.SetCellValue(sum.ToString(), ihang, jstart);

                        float gwidth = 13.50F, gheifht = 13.50F;
                        //float gwidth = 10F, gheifht = 10F;
                        Microsoft.Office.Interop.Excel.Shape activShape, oldShape = null, kywShape = null;
                        int icolor = (int)(((uint)Color.White.B << 16) | (ushort)(((ushort)Color.White.G << 8) | Color.White.R));
                        range = (Excel.Range)xx.get_Range(xx.Cells[6, 1], xx.Cells[6, 1]);
                        fxstart = (float)Convert.ToDouble(range.Cells.Width);
                        range = (Excel.Range)xx.get_Range(xx.Cells[6, 2], xx.Cells[6, 2]);
                        fxstart += (float)Convert.ToDouble(range.Cells.Width);
                        range = (Excel.Range)xx.get_Range(xx.Cells[1, 1], xx.Cells[5, 1]);
                        fystart = (float)Convert.ToDouble(range.Cells.Height);
                        range = (Excel.Range)xx.get_Range(xx.Cells[6, 1], xx.Cells[6, 1]);
                        fystart = fystart + (float)(Convert.ToDouble(range.Cells.Height) / 2);
                        activShape = null;
                        for (int itemp = 0; itemp <= ista - item; itemp++) {

                            range = (Excel.Range)xx.get_Range(xx.Cells[6, itemp * 2 + jstart], xx.Cells[6, itemp * 2 + jstart + 1]);
                            float width = (float)Convert.ToDouble(range.Cells.Width);

                            PS_xl xl2 = Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>("where ParentGT='" + gtlis[item + itemp].gtID + "'");
                            if (xl2 == null) {
                                if (gtlis[item + itemp].gtModle.IndexOf("转角") == -1) {
                                    activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart + width / 2, fystart, gwidth, gheifht);
                                } else {
                                    PJ_tbsj tb2 = MainHelper.PlatformSqlMap.GetOne<PJ_tbsj>("where picName = '直角'");
                                    if (tb2 != null) {

                                        string tempPath = Path.GetTempPath();
                                        string tempfile = tempPath + "~" + Guid.NewGuid().ToString() + tb2.S1;
                                        FileStream fs;
                                        fs = new FileStream(tempfile, FileMode.Create, FileAccess.Write);
                                        BinaryWriter bw = new BinaryWriter(fs);
                                        bw.Write(tb2.picImage);
                                        bw.Flush();
                                        bw.Close();
                                        fs.Close();
                                        Image im = Bitmap.FromFile(tempfile);
                                        Bitmap bt = new Bitmap(im);
                                        decimal[,] a1 = new decimal[1, 2];
                                        decimal[,] a2 = new decimal[1, 2];
                                        if (item + itemp < gtlis.Count) {
                                            a1[0, 0] = gtlis[item + itemp].gtLat - gtlis[item + itemp - 1].gtLat;
                                            a1[0, 1] = gtlis[item + itemp].gtLon - gtlis[item + itemp - 1].gtLon;

                                            a2[0, 0] = gtlis[item + itemp + 1].gtLat - gtlis[item + itemp].gtLat;
                                            a2[0, 1] = gtlis[item + itemp + 1].gtLon - gtlis[item + itemp].gtLon;
                                        }
                                        decimal di = a1[0, 0] * a2[0, 0] + a1[0, 1] * a2[0, 1];
                                        double dl = Math.Sqrt(Convert.ToDouble(a1[0, 0] * a1[0, 0] + a1[0, 1] * a1[0, 1]) * Math.Sqrt(Convert.ToDouble(
                                            a2[0, 0] * a2[0, 0] + a2[0, 1] * a2[0, 1])));
                                        dc = Math.Round(180 * Math.Acos(Convert.ToDouble(di) / Convert.ToDouble(dl)) / 3.1415926, 0);
                                        if (gtlis[item + itemp].gtLon > gtlis[item + itemp - 1].gtLon) {
                                            strfx = "右转";
                                        } else {
                                            strfx = "左转";
                                        }
                                        int btw = (int)(bt.Width / 1.33f);
                                        int bth = (int)(bt.Height / 1.33f);
                                        if (btw < width / 2) {

                                            activShape = xx.Shapes.AddPicture(tempfile, MsoTriState.msoFalse, MsoTriState.msoTrue, fxstart + width / 2 - btw / 2, fystart + gheifht / 2 - bth / 2, btw, bth);
                                            if (strfx == "左转") {
                                                if (dc.ToString() != "NaN" && dc.ToString() != "非数字")
                                                    activShape.Rotation = (float)(90 - Convert.ToDouble(dc));
                                            } else {
                                                if (dc.ToString() != "NaN" && dc.ToString() != "非数字")
                                                    activShape.Rotation = (float)(90 + Convert.ToDouble(dc));
                                            }

                                        } else {
                                            activShape = xx.Shapes.AddPicture(tempfile, MsoTriState.msoFalse, MsoTriState.msoTrue, fxstart + width / 5, fystart + gheifht / 2 - bt.Height / 2, bt.Width, bt.Height);
                                            if (strfx == "左转") {
                                                if (dc.ToString() != "NaN" && dc.ToString() != "非数字")
                                                    activShape.Rotation = (float)(90 - Convert.ToDouble(dc));
                                            } else {
                                                if (dc.ToString() != "NaN" && dc.ToString() != "非数字")
                                                    activShape.Rotation = (float)(90 + Convert.ToDouble(dc));
                                            }

                                        }
                                    }
                                }
                            } else {
                                ex.SetCellValue(xl2.LineName, 5, itemp * 2 + 4);//分支线路
                                PJ_tbsj tb2 = MainHelper.PlatformSqlMap.GetOne<PJ_tbsj>("where picName = '分支'");
                                if (tb2 != null) {

                                    string tempPath = Path.GetTempPath();
                                    string tempfile = tempPath + "~" + Guid.NewGuid().ToString() + tb2.S1;
                                    FileStream fs;
                                    fs = new FileStream(tempfile, FileMode.Create, FileAccess.Write);
                                    BinaryWriter bw = new BinaryWriter(fs);
                                    bw.Write(tb2.picImage);
                                    bw.Flush();
                                    bw.Close();
                                    fs.Close();
                                    Image im = Bitmap.FromFile(tempfile);
                                    Bitmap bt = new Bitmap(im);
                                    int btw = (int)(bt.Width / 1.33f);
                                    int bth = (int)(bt.Height / 1.33f);
                                    if (btw < width / 2) {
                                        activShape = xx.Shapes.AddPicture(tempfile, MsoTriState.msoFalse, MsoTriState.msoTrue, fxstart + width / 2 - btw / 2, fystart + gheifht / 2 - bth / 2, btw, bth);
                                    } else {
                                        activShape = xx.Shapes.AddPicture(tempfile, MsoTriState.msoFalse, MsoTriState.msoTrue, fxstart + width / 5, fystart + gheifht / 2 - bth / 2, btw, bth);
                                    }

                                } else {
                                    activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart + width / 2, fystart, gwidth, gheifht);
                                }


                            }
                            //activShape = xx.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, fxstart, fystart, gwidth, gheifht);
                            activShape.Fill.ForeColor.RGB = icolor;
                            if (itemp > 0) {
                                IList<PJ_05jcky> kyxli = MainHelper.PlatformSqlMap.GetList<PJ_05jcky>(" where gtID='" + gtlis[item + itemp].gtID + "'");
                                if (kyxli.Count == 0) {
                                    //Texture Image Recognition Algorithm Based on Steerable Pyramid Transform
                                    //if (Export17.ExistsRegedit() == 1) {//vs2003
                                    //    xx.Shapes.AddConnector(Microsoft.Office.Core.MsoConnectorType.msoConnectorStraight,
                                    //        oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2,
                                    //        //activShape.Left , oldShape.Top + oldShape.Height / 2);
                                    //     activShape.Left - (oldShape.Left + oldShape.Width), 0);
                                    //} else 
                                    {
                                        xx.Shapes.AddLine(
                                              oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2,
                                              activShape.Left, activShape.Top + activShape.Height / 2);
                                    }
                                } else {
                                    PJ_tbsj tb = MainHelper.PlatformSqlMap.GetOne<PJ_tbsj>("where picName = '" + kyxli[0].kymc + "'");
                                    if (tb != null) {
                                        string tempPath = Path.GetTempPath();
                                        string tempfile = tempPath + "~" + Guid.NewGuid().ToString() + tb.S1;
                                        FileStream fs;
                                        fs = new FileStream(tempfile, FileMode.Create, FileAccess.Write);
                                        BinaryWriter bw = new BinaryWriter(fs);
                                        bw.Write(tb.picImage);
                                        bw.Flush();
                                        bw.Close();
                                        fs.Close();
                                        Image im = Bitmap.FromFile(tempfile);
                                        Bitmap bt = new Bitmap(im);
                                        int btw = (int)(bt.Width / 1.33f);
                                        int bth = (int)(bt.Height / 1.33f);
                                        if (btw < width / 2) {
                                            kywShape = xx.Shapes.AddPicture(tempfile, MsoTriState.msoFalse, MsoTriState.msoTrue, oldShape.Left + oldShape.Width + width / 2 - btw / 2, oldShape.Top + oldShape.Height / 2 - bth / 2, btw, bth);
                                            // xx.Shapes.AddConnector(Microsoft.Office.Core.MsoConnectorType.msoConnectorStraight,
                                            //oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2,
                                            //kywShape.Left, oldShape.Top + oldShape.Height / 2);
                                            xx.Shapes.AddLine(
                                          oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2,
                                          kywShape.Left, oldShape.Top + oldShape.Height / 2);

                                            //  xx.Shapes.AddConnector(Microsoft.Office.Core.MsoConnectorType.msoConnectorStraight,
                                            //kywShape.Left + (float)(kywShape.Width - 2), kywShape.Top + kywShape.Height / 2,
                                            //activShape.Left + 2, kywShape.Top + kywShape.Height / 2);

                                            xx.Shapes.AddLine(
                                          kywShape.Left + (float)(kywShape.Width - 2), kywShape.Top + kywShape.Height / 2,
                                          activShape.Left + 2, kywShape.Top + kywShape.Height / 2);
                                        } else {
                                            //  kywShape = xx.Shapes.AddPicture(tempfile, MsoTriState.msoFalse, MsoTriState.msoTrue, oldShape.Left + oldShape.Width + width / 5, oldShape.Top + oldShape.Height / 2 - bth / 2, btw, bth);
                                            //  xx.Shapes.AddConnector(Microsoft.Office.Core.MsoConnectorType.msoConnectorStraight,
                                            // oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2,
                                            // kywShape.Left, oldShape.Top + oldShape.Height / 2);

                                            //  xx.Shapes.AddConnector(Microsoft.Office.Core.MsoConnectorType.msoConnectorStraight,
                                            //kywShape.Left + (float)(kywShape.Width - 1), kywShape.Top + kywShape.Height / 2,
                                            //activShape.Left + 1, kywShape.Top + kywShape.Height / 2);

                                            xx.Shapes.AddLine(
                                           oldShape.Left + oldShape.Width, oldShape.Top + oldShape.Height / 2,
                                           kywShape.Left, oldShape.Top + oldShape.Height / 2);

                                            xx.Shapes.AddLine(
                                          kywShape.Left + (float)(kywShape.Width - 1), kywShape.Top + kywShape.Height / 2,
                                          activShape.Left + 1, kywShape.Top + kywShape.Height / 2);
                                        }
                                        //Image im = Bitmap.FromFile(tempfile);
                                        //Bitmap bt = new Bitmap(im);
                                        //DataObject dataObject = new DataObject();
                                        //dataObject.SetData(DataFormats.Bitmap, bt);
                                        //Clipboard.SetDataObject(dataObject, true);

                                    }
                                }
                            }
                            //fxstart += gtwidth[itemp];
                            fxstart += width;
                            oldShape = activShape;
                        }
                    }
                    ihang++;

                    //横担
                    if (hdobj != null && hdobj.Count > 0) {

                        if (hdobj.Count > hdRowCount) {
                            for (j = hdRowCount; j < hdobj.Count; j++) {
                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + hdRowCount, "A"], xx.Cells[ihang + hdRowCount, "A"]);
                                range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing);
                                for (int item = 0; item < 29; item += 2) {
                                    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + hdRowCount, jstart + item], xx.Cells[ihang + hdRowCount, jstart + 1 + item]);
                                    range.Merge(Type.Missing);
                                }
                            }

                            hdRowCount = hdobj.Count;
                            range = (Excel.Range)xx.get_Range(xx.Cells[ihang, 1], xx.Cells[ihang + hdRowCount - 1, 1]);
                            range.Merge(Type.Missing);
                        }
                        for (j = 0; j < hdobj.Count; j++) {
                            ex.SetCellValue(hdobj[j].ToString(), ihang + j, jlie);
                            //if (j + 1 < hdobj.Count)
                            //{
                            //    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + 1, 1], xx.Cells[ihang + 1, 1]);
                            //    range.Insert(Excel.XlInsertShiftDirection.xlShiftDown, Type.Missing);
                            //    ihang++;
                            //}
                        }

                    }
                    ihang += hdRowCount;
                    //拉线规格/条数
                    if (lxlist != null && lxlist.Count > 0) {

                        if (lxlist.Count > lxRowCount) {
                            for (j = lxRowCount; j < lxlist.Count; j++) {
                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + lxRowCount, "A"], xx.Cells[ihang + lxRowCount, "A"]);
                                range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing);
                                //for (int item = 0; item < 29; item += 2)
                                //{
                                //    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + j + 1, jstart + item], xx.Cells[ihang + j + 1, jstart + 1 + item]);
                                //    range.Merge(Type.Missing);
                                //}
                            }
                            for (int jtem = lxRowCount; jtem < lxlist.Count; jtem++) {
                                for (int item = 0; item < 29; item += 2) {
                                    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jtem, jstart + item], xx.Cells[ihang + jtem, jstart + item + 1]);
                                    range.Merge(Type.Missing);
                                }
                            }
                            lxRowCount = lxlist.Count;
                            range = (Excel.Range)xx.get_Range(xx.Cells[ihang, 1], xx.Cells[ihang + lxRowCount - 1, 1]);
                            range.Merge(Type.Missing);
                        }
                        for (j = 0; j < lxlist.Count; j++) {
                            int icount = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select   sum(sbNumber) from PS_gtsb where sbModle = '" + lxlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'"));
                            //int icount = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_gtsb>(" Where sbModle = '" + lxlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'");
                            ex.SetCellValue(lxlist[j].ToString()/* + "/" + icount*/, ihang + j, jlie);

                        }
                    }
                    ihang += lxRowCount;

                    //绝缘子型号/数量
                    if (jyuzlist != null) {

                        if (jyuzlist.Count > jyzRowCount) {
                            for (j = jyzRowCount + 1; j < jyuzlist.Count; j = j + 2) {

                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jyzRowCount, "A"], xx.Cells[ihang + jyzRowCount, "A"]);
                                range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing);

                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + j, 2], xx.Cells[ihang + j - 1, 2]);
                                range.Merge(Type.Missing);
                            }
                            //for (int jtem = 0; jtem < jyuzlist.Count; jtem++) {
                            //    for (int item = 0; item < 29; item += 2) {
                            //        range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jtem, jstart + item], xx.Cells[ihang + jtem, jstart + 1 + item]);
                            //        range.Merge(Type.Missing);
                            //    }
                            //}
                            jyzRowCount = jyuzlist.Count / 2 + jyuzlist.Count % 2 == 0 ? 0 : 1;
                            range = (Excel.Range)xx.get_Range(xx.Cells[ihang, 1], xx.Cells[ihang + jyzRowCount - 1, 1]);
                            range.Merge(Type.Missing);
                        }
                        for (j = 0; j < jyuzlist.Count; j++) {
                            int icount = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select   sum(sbNumber) from PS_gtsb where sbModle = '" + jyuzlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'"));
                            //int icount = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_gtsb>(" Where sbModle = '" + jyuzlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'");
                            ex.SetCellValue(jyuzlist[j].ToString() /*+ "/" + icount*/, ihang + j / 2, jlie + j % 2);
                            ex.SetCellValue(icount.ToString(), ihang + j / 2 + 1, jlie + j % 2);

                        }
                    }
                    ihang += jyzRowCount * 2;
                    //变台型式
                    if (btlist != null) {
                        if (btlist.Count > 0) {
                            //ilisttemp = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct sbCode from PS_gtsb  Where  sbModle = '" + btlist[0].ToString() + "' and gtID='" + gtobj.gtID + "'");
                            ilisttemp = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct byqModle from PS_tqbyq  Where tqID  in ( select tqID from PS_tq where  gtID='" + gtobj.gtID + "')");
                            //if (ilisttemp.Count > btRowCount) {
                            //    for (j = btRowCount; j < ilisttemp.Count; j++) {
                            //        range = (Excel.Range)xx.get_Range(xx.Cells[ihang + btRowCount + 1, "A"], xx.Cells[ihang + btRowCount + 1, "A"]);
                            //        range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing);

                            //        range = (Excel.Range)xx.get_Range(xx.Cells[ihang + j, 2], xx.Cells[ihang + j + 1, 2]);
                            //        range.Merge(Type.Missing);

                            //    }
                            //    for (int jtem = 1; jtem < ilisttemp.Count; jtem++) {
                            //        for (int item = 0; item < 29; item += 2) {
                            //            range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jtem + 3, jstart + item], xx.Cells[ihang + jtem + 3, jstart + item + 1]);
                            //            range.Merge(Type.Missing);
                            //        }
                            //    }

                            //    btRowCount = ilisttemp.Count;
                            //    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + 1, 1], xx.Cells[ihang + btRowCount + 1 - 1, 1]);
                            //    range.Merge(Type.Missing);
                            //}
                            //if (btlist.Count == 1)
                            ex.SetCellValue(btlist[0].ToString(), ihang, jlie);
                            //else
                            //{
                            //    j = j;
                            //}
                            int byqrl = 0;
                            int icount = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select   count(*) from PS_tqbyq where  tqID  in ( select tqID from PS_tq where  gtID='" + gtobj.gtID + "')"));
                            for (j = 0; j < Math.Min(ilisttemp.Count, 2); j++) {//只能显示两个
                                //int icount = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select   sum(sbNumber) from PS_gtsb where sbCode='" + ilisttemp[0].ToString() + "' and  sbModle = '" + btlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'"));
                                ////int icount = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_gtsb>(" Where sbCode='" + ilisttemp[0].ToString() + "' and  sbModle = '" + btlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'");
                                //PS_gtsb gtsbtemp = Client.ClientHelper.PlatformSqlMap.GetOne<PS_gtsb>(" Where sbCode='" + ilisttemp[0].ToString() + "' and sbModle = '" + btlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'");
                                PS_tqbyq gtsbtemp = Client.ClientHelper.PlatformSqlMap.GetOne<PS_tqbyq>(" Where byqModle='" + ilisttemp[j].ToString() + "'   and tqID  in ( select tqID from PS_tq where  gtID='" + gtobj.gtID + "')");
                                if (gtsbtemp != null) {
                                    //PS_sbcs sbcstemp = Client.ClientHelper.PlatformSqlMap.GetOneByKey<PS_sbcs>(gtsbtemp.sbType + ilisttemp[0].ToString());
                                    //if (sbcstemp != null)
                                    //{
                                    //ex.SetCellValue(sbcstemp.xh + "/" + icount.ToString(), ihang + j + 1, jlie);
                                    //}
                                    byqrl += gtsbtemp.byqCapcity;
                                    if (gtsbtemp.byqModle.IndexOf("-") < 0) {
                                        ex.SetCellValue(gtsbtemp.byqModle /*+ "/" + icount.ToString()*/, ihang + 1, jlie + j);
                                        //ex.SetCellValue(/*gtsbtemp.byqModle + "/" +*/ icount.ToString(), ihang+j  + 2, jlie);
                                        //ex.SetCellValue(gtsbtemp.byqCapcity.ToString(), ihang+j  + 3, jlie);
                                    } else {
                                        ex.SetCellValue(gtsbtemp.byqModle.Substring(0, gtsbtemp.byqModle.IndexOf("-"))  /*+ "/"+ icount.ToString()*/, ihang + 1, jlie + j);

                                    }
                                }
                            }
                            ex.SetCellValue(icount.ToString(), ihang + 2, jlie);
                            ex.SetCellValue(byqrl.ToString(), ihang + 3, jlie);
                        }

                    }
                    ihang += btRowCount + 3;

                    //避雷器型号/数量
                    if (blqlist != null && blqlist.Count > 0) {

                        if (blqlist.Count > blqRowCount) {

                            for (j = blqRowCount; j < blqlist.Count; j++) {
                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + blqRowCount, "A"], xx.Cells[ihang + blqRowCount, "A"]);
                                range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, Type.Missing);

                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + j, 2], xx.Cells[ihang + j - 1, 2]);
                                range.Merge(Type.Missing);


                            }
                            for (int jtem = 0; jtem < blqlist.Count; jtem++) {
                                for (int item = 0; item < 29; item += 2) {
                                    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jtem, jstart + item], xx.Cells[ihang + jtem, jstart + 1 + item]);
                                    range.Merge(Type.Missing);
                                }
                            }
                            blqRowCount = blqlist.Count;
                            range = (Excel.Range)xx.get_Range(xx.Cells[ihang, 1], xx.Cells[ihang + blqRowCount - 1, 1]);
                            range.Merge(Type.Missing);
                        }
                        for (j = 0; j < blqlist.Count; j++) {
                            int icount = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select   sum(sbNumber) from PS_gtsb  Where sbModle = '" + blqlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'"));
                            // int icount = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_gtsb>(" Where sbModle = '" + blqlist[j].ToString() + "' and gtID='" + gtobj.gtID + "'");
                            ex.SetCellValue(blqlist[j].ToString(), ihang + j, jlie);
                            ex.SetCellValue(icount.ToString(), ihang + j + 1, jlie);

                        }


                    }
                    ihang += blqRowCount + 1;

                    //开关型号/数量
                    if (kglist != null && kglist.Count > 0) {

                        if (kglist.Count > kgRowCount) {

                            for (j = kgRowCount; j < kglist.Count; j++) {
                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + kgRowCount, "A"], xx.Cells[ihang + kgRowCount, "A"]);
                                range.EntireRow.Insert(Excel.XlInsertShiftDirection.xlShiftDown, Type.Missing);

                                range = (Excel.Range)xx.get_Range(xx.Cells[ihang + j, 2], xx.Cells[ihang + j - 1, 2]);
                                range.Merge(Type.Missing);


                            }
                            for (int jtem = 0; jtem < kglist.Count; jtem++) {
                                for (int item = 0; item < 29; item += 2) {
                                    range = (Excel.Range)xx.get_Range(xx.Cells[ihang + jtem, jstart + item], xx.Cells[ihang + jtem, jstart + 1 + item]);
                                    range.Merge(Type.Missing);
                                }
                            }
                            kgRowCount = kglist.Count;
                            range = (Excel.Range)xx.get_Range(xx.Cells[ihang, 1], xx.Cells[ihang + kgRowCount - 1, 1]);
                            range.Merge(Type.Missing);
                        }
                        for (j = 0; j < kglist.Count; j++) {
                            try {
                                //int icount = Convert.ToInt32(Client.ClientHelper.PlatformSqlMap.GetObject("SelectOneInt", "select   sum(sbNumber) from PS_gtsb  Where sbModle = '" + kglist[j].ToString() + "' and gtID='" + gtobj.gtID + "'"));
                                //int icount = Client.ClientHelper.PlatformSqlMap.GetRowCount<PS_kg>(" Where kgModle = '" + kglist[j].ToString() + "' and gtID='" + gtobj.gtID + "'");
                                ex.SetCellValue(kglist[j].ToString(), ihang + j, jlie);

                            } catch { }

                        }
                        ex.SetCellValue(kglist.Count.ToString(), ihang + 2, jlie);
                    }
                    ihang += kgRowCount + 2;

                    jlie += 2;
                }
                //#region 画图形
                //dsoFramerWordControl1.FileOpen(outfname);
                //Microsoft.Office.Interop.Excel.Workbook wb;
                //Microsoft.Office.Interop.Excel.Worksheet xx;
                //try
                //{
                //    wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook;
                //    xx = wb.Application.Sheets[1] as Microsoft.Office.Interop.Excel.Worksheet;

                //}
                //catch (Exception err)
                //{
                //    dsoFramerWordControl1.FileClose();
                //    throw new Exception("excel的打开方式不对,有可能装有wps", err);
                //}
                //Excel.Range range;
                //if (lieindex < 1)
                //    range = (Excel.Range)xx.get_Range(xx.Cells[5, 1], xx.Cells[RowCount, ColumnCount]);
                //else
                //    range = (Excel.Range)xx.get_Range(xx.Cells[5, 1], xx.Cells[RowCount, lieindex + 2]);

                //range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous;
                //range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop].Weight = Excel.XlBorderWeight.xlThick;
                //range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous;
                //range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeRight].Weight = Excel.XlBorderWeight.xlThick;
                //range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
                //range.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeBottom].Weight = Excel.XlBorderWeight.xlThick;
                ex.ActiveSheet(1);


            } catch (Exception exmess) {
                MsgBox.ShowTipMessageBox(exmess.Message.ToString());
            }
            dsoFramerWordControl1.FileSave();
            pj17.BigData = dsoFramerWordControl1.FileDataGzip;
            dsoFramerWordControl1.FileClose();
            dsoFramerWordControl1.Dispose();
            //#endregion
            //System.Diagnostics.Process.Start(outfname);
            return 1;
        }
Beispiel #9
0
        private void btReAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            if (btXlList.EditValue == null || btXlList.EditValue.ToString() == "") {
                return;
            }
            PS_xl xl = btXlList.EditValue as PS_xl;
            PJ_17 pj = new PJ_17();
            pj.CreateDate = DateTime.Now;
            pj.CreateMan = MainHelper.User.UserName;
            pj.LineName = xl.LineName;
            pj.LineCode = xl.LineCode;
            pj.OrgCode = xl.OrgCode;
            pj.OrgName = parentObj.OrgName;
            pj.Remark = "";
            MainHelper.PlatformSqlMap.Create<PJ_17>(pj);

            InitData();
            //if (MsgBox.ShowAskMessageBox("是否马上生成条图") == DialogResult.OK)
            {

                try {
                    if (ExportToExcel("高压配电线路条图", "", pj) < 1) return;

                    frm17Template frm = new frm17Template();
                    frm.pjobject = pj;
                    if (frm.ShowDialog() == DialogResult.OK) {
                        Client.ClientHelper.PlatformSqlMap.Update<PJ_17>(frm.pjobject);
                        //MessageBox.Show("保存成功");
                    }
                } catch (Exception ex) {
                    MsgBox.ShowException(ex);

                }
            }

        }
Beispiel #10
0
 void treeViewOperator_AfterDelete(PJ_17 newobj) {
     if (AfterDelete != null)
         AfterDelete(treeList1, newobj);
 }