public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //���8 ��6 �� rowcount = 8; colcount = 6; //�������һ�еı��� title = TC.GetTableTitle(this.GetType().Name); //�������й���� //int[] TableYearsAry = TC.GetTableYears(this.GetType().Name); //�������� sheetname = title; //�趨����������ֵ������ͱ��� TC.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //�趨����ģʽ���Ա�д��ʽʹ�� TC.Sheet_Referen_R1C1(obj_sheet); //�趨����п�� obj_sheet.Columns[0].Width = 60; obj_sheet.Columns[1].Width = 100; obj_sheet.Columns[2].Width = 100; obj_sheet.Columns[3].Width = 80; obj_sheet.Columns[4].Width = 100; obj_sheet.Columns[5].Width = 80; //�趨����и߶� obj_sheet.Rows[0].Height = 20; obj_sheet.Rows[1].Height = 20; obj_sheet.Rows[2].Height = 20; //д���������� //2�б������� obj_sheet.AddSpanCell(1, 0, 2, 1); obj_sheet.AddSpanCell(1, 1, 2, 1); obj_sheet.SetValue(1, 2, "������"); obj_sheet.AddSpanCell(1, 3, 2, 1); obj_sheet.SetValue(1, 3, "�����ʣ�%��"); obj_sheet.SetValue(1, 4, "���縺��"); obj_sheet.AddSpanCell(1, 5, 2, 1); obj_sheet.SetValue(1, 5, "�����ʣ�%��"); //3�б������� obj_sheet.SetValue(2, 2, "����ǧ��ʱ��"); obj_sheet.SetValue(2, 4, "����ǧ�ߣ�"); //д���������� //1�б������� obj_sheet.SetValue(3, 0, "1"); //2�б������� obj_sheet.SetValue(3, 1, "ȫ��"); //������� Sheet_AddData(obj_sheet); //�趨����� TC.Sheet_GridandCenter(obj_sheet); //������� TC.Sheet_Locked(obj_sheet); }
private void AddItemsCol(FarPoint.Win.Spread.SheetView obj_sheet, int[] TableYearsAry) { //int[] TableYearsAry = TC.GetTableYears(this.GetType().Name); for (int i = 0; i < TableYearsAry.Length; i++) { obj_sheet.SetValue(2, 6+i,TableYearsAry[i]); } obj_sheet.AddSpanCell(1, 6, 1, TableYearsAry.Length); obj_sheet.SetValue(1, 6, "Ͷ����ݺ�Ͷ����ģ"); }
public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //�������й���� int[] TableYearsAry = TC.GetTableYears(this.GetType().Name); //���29 ��8 �� rowcount = 29; colcount = 2 + TableYearsAry.Length+1; //�������һ�еı��� title = TC.GetTableTitle(this.GetType().Name); //�������� sheetname = title; //�趨����������ֵ������ͱ��� TC.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //�趨����ģʽ���Ա�д��ʽʹ�� TC.Sheet_Referen_R1C1(obj_sheet); //�趨����п�� obj_sheet.Columns[0].Width = 60; obj_sheet.Columns[1].Width = 150; //�趨����и߶� obj_sheet.Rows[0].Height = 20; obj_sheet.Rows[1].Height = 20; //д���������� //2�б������� obj_sheet.SetValue(1, 0, "����"); obj_sheet.SetValue(1, 1, "ָ������"); for (int i = 0; i < TableYearsAry.Length; i++) { obj_sheet.SetValue(1, 2 + i, TableYearsAry[i]); obj_sheet.Columns[2 + i].Width = 60; } obj_sheet.SetValue(1, 2 + TableYearsAry.Length, "���������(%)"); obj_sheet.Columns[2 + TableYearsAry.Length].Width = 120; //д���������� //������� Sheet_AddData(obj_sheet); //�趨����� TC.Sheet_GridandCenter(obj_sheet); //������� TC.Sheet_Locked(obj_sheet); }
public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //���5 ��7 �� rowcount = 5; colcount = 7; //�������һ�еı��� title = TC.GetTableTitle(this.GetType().Name); //�������й���� //int[] TableYearsAry = TC.GetTableYears(this.GetType().Name); //�������� sheetname = title; //�趨����������ֵ������ͱ��� TC.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //�趨����ģʽ���Ա�д��ʽʹ�� TC.Sheet_Referen_R1C1(obj_sheet); //�趨����п�� obj_sheet.Columns[0].Width = 60; obj_sheet.Columns[1].Width = 80; obj_sheet.Columns[2].Width = 120; obj_sheet.Columns[3].Width = 80; obj_sheet.Columns[4].Width = 80; obj_sheet.Columns[5].Width = 80; obj_sheet.Columns[6].Width = 240; //�趨����и߶� obj_sheet.Rows[0].Height = 20; obj_sheet.Rows[1].Height = 20; //д���������� //2�б������� obj_sheet.SetValue(1, 0, "���"); obj_sheet.SetValue(1, 1, "��������"); obj_sheet.SetValue(1, 2, "����"); obj_sheet.SetValue(1, 3, "�����ѹ"); obj_sheet.SetValue(1, 4, "����"); obj_sheet.SetValue(1, 5, "װ������"); obj_sheet.SetValue(1, 6, "��ע"); //д���������� //1�б������� //������� Sheet_AddData(obj_sheet); //�趨����� TC.Sheet_GridandCenter(obj_sheet); //������� TC.Sheet_Locked(obj_sheet); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_13Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int IntColCount = 3; int IntRowCount = 6 + 2 + 3;//标题占3行,分区类型占2行 string title = null; obj.SheetName = Title; obj.Columns.Count = IntColCount; obj.Rows.Count = IntRowCount; IntCol = obj.Columns.Count; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); string strTitle = ""; IntRow = 3; strTitle = Title; PF.CreateSheetView(obj, IntRow, IntCol, 0, 0, Title); PF.SetSheetViewColumnsWidth(obj, 0, Title); IntCol = 1; strTitle = "单位:万千瓦 万千伏安 千伏 座 台"; obj.AddSpanCell(IntRow, 0, 1, obj.Columns.Count); obj.SetValue(IntRow, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, 0, strTitle); //右对齐 obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right; //列标题 strTitle = "序号"; PF.CreateSheetView(obj, NextRowMerge += 1, NextColMerge, IntRow += 1, IntCol -= 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); for (int i = 0; i < (IntColCount - 1); ++i) { switch (i) { case 0: strTitle = " 项 目 "; break; case 1: strTitle = " 统计 "; break; default: break; } PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); } NextRowMerge = 1; NextColMerge = 1; IntRow = 5; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet) { //写标题行内容 //2行标题内容 obj_sheet.AddSpanCell(1, 0, 2, 1); obj_sheet.SetValue(1, 0, "编号"); obj_sheet.AddSpanCell(1, 1, 2, 1); obj_sheet.SetValue(1, 1, "类型"); obj_sheet.AddSpanCell(1, 2, 2, 1); obj_sheet.SetValue(1, 2, "电压等级(kV)"); obj_sheet.AddSpanCell(1, 3, 2, 1); obj_sheet.SetValue(1, 3, "年限"); obj_sheet.AddSpanCell(1, 4, 1, 2); obj_sheet.SetValue(1, 4, "主变台数"); obj_sheet.AddSpanCell(1, 6, 1, 2); obj_sheet.SetValue(1, 6, "断路器"); //3行标题内容 obj_sheet.SetValue(2, 4, "数量(台)"); obj_sheet.SetValue(2, 5, "比例(%)"); obj_sheet.SetValue(2, 6, "数量(台)"); obj_sheet.SetValue(2, 7, "比例(%)"); //写标题列内容 //1列标题内容 obj_sheet.AddSpanCell(3, 0, 10, 1); obj_sheet.SetValue(3, 0, "1"); obj_sheet.AddSpanCell(13, 0, 10, 1); obj_sheet.SetValue(13, 0, "2"); obj_sheet.AddSpanCell(23, 0, 10, 1); obj_sheet.SetValue(23, 0, "2.1"); obj_sheet.AddSpanCell(33, 0, 10, 1); obj_sheet.SetValue(33, 0, "2.2"); obj_sheet.AddSpanCell(43, 0, 10, 1); obj_sheet.SetValue(43, 0, "2.3"); obj_sheet.AddSpanCell(53, 0, 10, 1); obj_sheet.SetValue(53, 0, "2.4"); obj_sheet.AddSpanCell(63, 0, 10, 1); obj_sheet.SetValue(63, 0, "3"); //2列标题内容 obj_sheet.AddSpanCell(3, 1, 10, 1); obj_sheet.SetValue(3, 1, "市辖供电区"); obj_sheet.AddSpanCell(13, 1, 10, 1); obj_sheet.SetValue(13, 1, "县级供电区"); obj_sheet.AddSpanCell(23, 1, 10, 1); obj_sheet.SetValue(23, 1, "其中:直供直管"); obj_sheet.AddSpanCell(33, 1, 10, 1); obj_sheet.SetValue(33, 1, "控股"); obj_sheet.AddSpanCell(43, 1, 10, 1); obj_sheet.SetValue(43, 1, "参股"); obj_sheet.AddSpanCell(53, 1, 10, 1); obj_sheet.SetValue(53, 1, "代管"); obj_sheet.AddSpanCell(63, 1, 10, 1); obj_sheet.SetValue(63, 1, "全地区"); //偱环添加列标题 for (int row = 3; row <= 72; row++) { obj_sheet.SetValue(row + 0, 3, "0-5年"); obj_sheet.SetValue(row + 1, 3, "6-10年"); obj_sheet.SetValue(row + 2, 3, "11-15年"); obj_sheet.SetValue(row + 3, 3, "16-20年"); obj_sheet.SetValue(row + 4, 3, "20年以上"); obj_sheet.AddSpanCell(row + 0, 2, 5, 1); obj_sheet.SetValue(row + 0, 2, "110(66)"); obj_sheet.SetValue(row + 5, 3, "0-5年"); obj_sheet.SetValue(row + 6, 3, "6-10年"); obj_sheet.SetValue(row + 7, 3, "11-15年"); obj_sheet.SetValue(row + 8, 3, "16-20年"); obj_sheet.SetValue(row + 9, 3, "20年以上"); obj_sheet.AddSpanCell(row + 5, 2, 5, 1); obj_sheet.SetValue(row + 5, 2, "35"); row = row + 9; } }
public void WriteData(FarPoint.Win.Spread.SheetView obj_sheet) { if (SDL320_21.Count != 0) { //市辖部分的行号 int SXrow = fc.Sheet_Find_Value(obj_sheet, 0, "市辖供电区"); //市辖供电区中第一行第二列的“合计”部分合并的行数就是电压等级数 int newdysum = obj_sheet.Cells[SXrow, 1].RowSpan; for (int row = SXrow + newdysum; row < obj_sheet.RowCount; row++) { string dq = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 0); string areaname = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1); string dy = obj_sheet.Cells[row, 2].Value.ToString(); for (int i = 0; i < SDL320_21.Count; i++) { if (dq == SDL320_21[i].DQ && areaname == SDL320_21[i].areaname && dy == SDL320_21[i].dy) { obj_sheet.SetValue(row, 3, SDL320_21[i].data); SDL320_21.Remove(SDL320_21[i]); break; } } } } }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet,Hashtable area_key_id, IList<double> obj_DY_List, IList<string> SXareaid_List, IList<string> XJareaid_List) { //写标题行内容 //2行标题内容 obj_sheet.SetValue(1, 0, "分区类型"); obj_sheet.SetValue(1, 1, "分区名称"); obj_sheet.SetValue(1, 2, "电压等级(kV)"); obj_sheet.SetValue(1, 3, "线路条数(条)"); obj_sheet.SetValue(1, 4, "环网线路条数"); obj_sheet.SetValue(1, 5, "双射线路条数"); obj_sheet.SetValue(1, 6, "单射线路条数"); obj_sheet.SetValue(1, 7, "其它结构线路条数"); obj_sheet.SetValue(1, 8, "环网比例(%)"); obj_sheet.SetValue(1, 9, "双射比例(%)"); obj_sheet.SetValue(1, 10, "单射比例(%)"); obj_sheet.SetValue(1, 11, "其它结构比例(%)"); //写标题列内容 fc.Sheet_AddItem_FBonlyDY(obj_sheet, area_key_id, 2, obj_DY_List, SXareaid_List, XJareaid_List); }
private void ComparisonData(FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol) { for (int i = IntRow; i < obj.RowCount; i += 2)//行从第IntRow行开始载入 { for (int l = 0; l < SaveList.Count; ++l) { if ((SaveList[l].strType == PF.ReturnStr(obj, i, 0).ToString()) && (SaveList[l].strDQ == PF.ReturnStr(obj, i, 1).ToString())) { for (int j = IntCol; j < obj.ColumnCount; ++j)// { obj.SetValue(i, j, SaveList[l].data[0, j - IntCol]); obj.SetValue(i + 1, j, SaveList[l].data[1, j - IntCol]); } SaveList.Remove(SaveList[l]); break; } } } }
//�˴�Ϊ��̬������ݷ��� private void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet) { int startrow = 2; int addnum = 0; int itemcount = 0; int firstrow = 0; ArrayList rowsum = new ArrayList(); Itop.Domain.PWTable.PW_tb3a p = new Itop.Domain.PWTable.PW_tb3a(); p.col2 = Itop.Client.MIS.ProgUID; IList<PW_tb3a> alist = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aListDIS", p); for (int n = 0; n < alist.Count; n++) { for (int m = 0; m < 8; m++) { obj_sheet.RowCount = obj_sheet.RowCount + 1; } obj_sheet.AddSpanCell(2, 0, 8, 1); obj_sheet.SetValue(2, 0, "XX�����أ�"); //2�б������� obj_sheet.AddSpanCell(startrow+n * 8, 1, 6, 1); obj_sheet.SetValue(startrow + n * 8, 1, "���ͽ��ߣ��أ�"); obj_sheet.AddSpanCell(startrow + (n + 1) * 8-1, 1, 1, 2); obj_sheet.SetValue(startrow + (n + 1) * 8-1, 1, "������"); obj_sheet.AddSpanCell(startrow + (n + 1) * 8, 1, 1, 2); obj_sheet.SetValue(startrow + (n+1) * 8, 1, "�����ǵ��ͽ��ߣ��أ�"); //3�б������� obj_sheet.SetValue(startrow + n * 8, 2, "����һ��"); obj_sheet.SetValue(startrow + n * 8+1, 2, "����һ��"); obj_sheet.SetValue(startrow + n * 8 + 2, 2, "������"); obj_sheet.SetValue(startrow + n * 8 + 3, 2, "˫����"); obj_sheet.SetValue(startrow + n * 8 + 4, 2, "��ֶ�������"); obj_sheet.SetValue(startrow + n * 8 + 5, 2, "��ֶ�������"); PW_tb3a _tba = alist[n]; p.PQName = _tba.PQName; p.JXMS = "����һ��"; IList<PW_tb3a> list1 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "����һ��"; IList<PW_tb3a> list2 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "������"; IList<PW_tb3a> list3 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "˫����"; IList<PW_tb3a> list4 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "��ֶ�������"; IList<PW_tb3a> list5 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "��ֶ�������"; IList<PW_tb3a> list6 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "������"; IList<PW_tb3a> list7 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); p.JXMS = "�����ǵ��ͽ���"; IList<PW_tb3a> list8 = Services.BaseService.GetList<PW_tb3a>("SelectPW_tb3aBy2255", p); if (list1.Count > 0) { PW_tb3a obj = list1[0]; obj_sheet.SetValue(n+startrow+n*7, 0, obj.PQName); obj_sheet.SetValue(n+startrow+n*7, 3, obj.Num1); obj_sheet.SetValue(n+startrow+n*7, 4, obj.Num2); obj_sheet.SetValue(n+startrow+n*7, 5, obj.Num3); obj_sheet.SetValue(n+startrow+n*7, 6, obj.Num4); obj_sheet.SetValue(n+startrow+n*7, 7, obj.Num5); obj_sheet.SetValue(n+startrow+n*7, 8, obj.Num6); obj_sheet.SetValue(n+startrow+n*7, 9, obj.Num7); obj_sheet.SetValue(n+startrow+n*7, 10, obj.Num8); } else { TC.Sheet_WriteZero(obj_sheet, n + startrow+n*7,3,1,8); } } }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet, List<string[]> SxXjName) { int startrow = 2; //2行标题内容 obj_sheet.SetValue(1, 0, "编号"); obj_sheet.SetValue(1, 1, "类型"); obj_sheet.SetValue(1, 2, "2010年"); obj_sheet.SetValue(1, 3, "2011年"); obj_sheet.SetValue(1, 4, "2012年"); obj_sheet.SetValue(1, 5, "2013年"); obj_sheet.SetValue(1, 6, "2014年"); obj_sheet.SetValue(1, 7, "2015年"); obj_sheet.SetValue(1, 8, "2020年"); //写标题列内容 for (int i = 0; i < SxXjName.Count; i++) { obj_sheet.SetValue(startrow + i, 0, SxXjName[i][0]); obj_sheet.SetValue(startrow + i, 1, SxXjName[i][1]); } }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_2Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { SelectDQ(FB); int IntColCount = 2; int IntRowCount =1+ AreaList.Count + 1 + 2 + 3;//标题占3行,分区类型占2行,1是其它用 string title = null; obj.SheetName = Title; obj.Columns.Count = IntColCount; obj.Rows.Count = IntRowCount; IntCol = obj.Columns.Count; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); string strTitle = ""; IntRow = 3; strTitle = Title; PF.CreateSheetView(obj, IntRow, IntCol, 0, 0, Title); PF.SetSheetViewColumnsWidth(obj, 0, Title); IntCol = 1; strTitle = "单位:万人、平方公里"; obj.AddSpanCell(IntRow, 0, 1, obj.Columns.Count); obj.SetValue(IntRow, 0, strTitle); //右对齐 obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right; strTitle = " 镇/片区"; PF.CreateSheetView(obj, NextRowMerge += 1, NextColMerge, IntRow += 1, IntCol -= 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "面积"; PF.CreateSheetView(obj, NextRowMerge , NextColMerge, IntRow , IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, "60"); for (int i = 0; i < AreaList.Count+1; ++i) { if(i!=AreaList.Count) { PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + i + 2), 0, AreaList[i].ToString()); PF.SetSheetViewColumnsWidth(obj, IntCol, AreaList[i].ToString()); } else { PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + i + 2), 0, "合计"); } } NextRowMerge = 1; NextColMerge = 1; IntRow = 5; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet, IList<string> SXareaid_List, IList<string> XJareaid_List) { //写标题行内容 //2行标题内容 obj_sheet.AddSpanCell(1, 0, 2, 1); obj_sheet.SetValue(1, 0, "分区类型"); obj_sheet.AddSpanCell(1, 1, 2, 1); obj_sheet.SetValue(1, 1, "分区名称"); obj_sheet.AddSpanCell(1, 2, 2, 1); obj_sheet.SetValue(1, 2, "电压等级"); obj_sheet.AddSpanCell(1, 3, 2, 1); obj_sheet.SetValue(1, 3, "建设型式"); obj_sheet.AddSpanCell(1, 4, 2, 1); obj_sheet.SetValue(1, 4, "平均用地需求"); obj_sheet.AddSpanCell(1, 5, 1, 2); obj_sheet.SetValue(1, 5, "2010年"); obj_sheet.AddSpanCell(1, 7, 1, 2); obj_sheet.SetValue(1, 7, "2011年"); obj_sheet.AddSpanCell(1, 9, 1, 2); obj_sheet.SetValue(1, 9, "2012年"); obj_sheet.AddSpanCell(1, 11, 1, 2); obj_sheet.SetValue(1, 11, "2013年"); obj_sheet.AddSpanCell(1, 13, 1, 2); obj_sheet.SetValue(1, 13, "2014年"); obj_sheet.AddSpanCell(1, 15, 1, 2); obj_sheet.SetValue(1, 15, "2015年"); obj_sheet.AddSpanCell(1, 17, 1, 2); obj_sheet.SetValue(1, 17, "“十二五”合计"); //3行标题内容 obj_sheet.SetValue(2, 5, "座数"); obj_sheet.SetValue(2, 6, "用地需求"); obj_sheet.SetValue(2, 7, "座数"); obj_sheet.SetValue(2, 8, "用地需求"); obj_sheet.SetValue(2, 9, "座数"); obj_sheet.SetValue(2, 10, "用地需求"); obj_sheet.SetValue(2, 11, "座数"); obj_sheet.SetValue(2, 12, "用地需求"); obj_sheet.SetValue(2, 13, "座数"); obj_sheet.SetValue(2, 14, "用地需求"); obj_sheet.SetValue(2, 15, "座数"); obj_sheet.SetValue(2, 16, "用地需求"); obj_sheet.SetValue(2, 17, "座数"); obj_sheet.SetValue(2, 18, "用地需求"); //写标题列内容 //4列标题内容 obj_sheet.SetValue(3, 3, "户外"); obj_sheet.SetValue(4, 3, "半户内"); obj_sheet.SetValue(5, 3, "户内"); obj_sheet.SetValue(6, 3, "其它"); //写标题列内容 List<string> obj_DY_List = new List<string>(); obj_DY_List.Add("110(66)"); obj_DY_List.Add("35"); int startrow = 3; int dylength = obj_DY_List.Count; int length = 4; if (obj_DY_List.Count > 0) { for (int i = 0; i < (2 + SXareaid_List.Count + XJareaid_List.Count); i++) { string areaname = ""; if (i == 0 || i == (SXareaid_List.Count + 1)) { areaname = "合计"; } else { if (i < SXareaid_List.Count + 1) { areaname = SXareaid_List[i - 1].ToString(); } else { areaname = XJareaid_List[i - SXareaid_List.Count - 2].ToString(); } } for (int j = 0; j < obj_DY_List.Count; j++) { int row = startrow + i * dylength * length + j * length; obj_sheet.SetValue(row, 3, "户外"); obj_sheet.SetValue(row + 1, 3, "半户内"); obj_sheet.SetValue(row + 2, 3, "户内"); obj_sheet.SetValue(row + 3, 3, "其它"); obj_sheet.AddSpanCell(startrow + i * dylength * length + j * length, 2, length, 1); obj_sheet.SetValue(startrow + i * dylength * length + j * length, 2, obj_DY_List[j].ToString()); } obj_sheet.AddSpanCell(startrow + i * dylength * length, 1, dylength * length, 1); obj_sheet.SetValue(startrow + i * dylength * length, 1, areaname); } //写第一列数据 obj_sheet.AddSpanCell(startrow, 0, (SXareaid_List.Count + 1) * dylength * length, 1); obj_sheet.SetValue(startrow, 0, "市辖供电区"); obj_sheet.AddSpanCell(startrow + (SXareaid_List.Count + 1) * dylength * length, 0, (XJareaid_List.Count + 1) * dylength * length, 1); obj_sheet.SetValue(startrow + (SXareaid_List.Count + 1) * dylength * length, 0, "县级供电区"); } }
public void WriteData(FarPoint.Win.Spread.SheetView obj_sheet) { int startrow = 3 + 8; int xjrow = fc.Sheet_Find_Value(obj_sheet, 0, "县级供电区"); for (int row = startrow; row < xjrow; row++) { for (int k = 0; k < save91_52list.Count; k++) { if (save91_52list[k].DQ=="市辖供电区"&&save91_52list[k].AreaName==fc.Sheet_find_Rownotemptycell(obj_sheet,row,1)) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 12; j++) { obj_sheet.SetValue(row + i, 5 + j,save91_52list[k].data[i,j]); } } save91_52list.Remove(save91_52list[k]); row = row + 7; break; } } } for (int row = xjrow + 8; row < obj_sheet.RowCount; row++) { for (int k = 0; k < save91_52list.Count; k++) { if (save91_52list[k].DQ == "县级供电区" && save91_52list[k].AreaName == fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1)) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 12; j++) { obj_sheet.SetValue(row + i, 5 + j, save91_52list[k].data[i, j]); } } save91_52list.Remove(save91_52list[k]); row = row + 7; break; } } } }
public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //���9 ��11 �� rowcount = 9; colcount = 11; //�������һ�еı��� title = TC.GetTableTitle(this.GetType().Name); //�������й���� //int[] TableYearsAry = TC.GetTableYears(this.GetType().Name); //�������� sheetname = title; //�趨����������ֵ������ͱ��� TC.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //�趨����ģʽ���Ա�д��ʽʹ�� TC.Sheet_Referen_R1C1(obj_sheet); //�趨����п�� obj_sheet.Columns[0].Width = 60; obj_sheet.Columns[1].Width = 100; obj_sheet.Columns[2].Width = 60; obj_sheet.Columns[3].Width = 60; obj_sheet.Columns[4].Width = 60; obj_sheet.Columns[5].Width = 60; obj_sheet.Columns[6].Width = 60; obj_sheet.Columns[7].Width = 60; obj_sheet.Columns[8].Width = 60; obj_sheet.Columns[9].Width = 60; obj_sheet.Columns[10].Width = 60; //�趨����и߶� obj_sheet.Rows[0].Height = 20; obj_sheet.Rows[1].Height = 20; obj_sheet.Rows[2].Height = 20; //д���������� //2�б������� obj_sheet.AddSpanCell(1, 0, 2, 1); obj_sheet.SetValue(1, 0, "����"); obj_sheet.SetValue(1, 1, "װ���������"); obj_sheet.AddSpanCell(1, 2, 2, 1); obj_sheet.SetValue(1, 2, "<2"); obj_sheet.AddSpanCell(1, 3, 2, 1); obj_sheet.SetValue(1, 3, "2~4"); obj_sheet.AddSpanCell(1, 4, 2, 1); obj_sheet.SetValue(1, 4, "4~6"); obj_sheet.AddSpanCell(1, 5, 2, 1); obj_sheet.SetValue(1, 5, "6~8"); obj_sheet.AddSpanCell(1, 6, 2, 1); obj_sheet.SetValue(1, 6, "8~10"); obj_sheet.AddSpanCell(1, 7, 2, 1); obj_sheet.SetValue(1, 7, "10~12"); obj_sheet.AddSpanCell(1, 8, 2, 1); obj_sheet.SetValue(1, 8, "12~15"); obj_sheet.AddSpanCell(1, 9, 2, 1); obj_sheet.SetValue(1, 9, ">15"); obj_sheet.AddSpanCell(1, 10, 2, 1); obj_sheet.SetValue(1, 10, "�ϼ�"); //3�б������� obj_sheet.SetValue(2, 1, "����ǧ������"); //д���������� //������� Sheet_AddData(obj_sheet); //�趨����� TC.Sheet_GridandCenter(obj_sheet); //������� TC.Sheet_Locked(obj_sheet); }
/// <summary> /// 写入数据 /// </summary> /// <param name="obj"></param> /// <param name="IntRow"></param> /// <param name="IntCol"></param> private void WriteData(FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol) { string strTitle = null; string strDQ = null; for (int i = IntRow; i < obj.RowCount; ++i) { strTitle = (string)PF.ReturnStr(obj,i,0); strDQ = (string)PF.ReturnStr(obj, i, 1); for (int j = 2; j < obj.ColumnCount; ++j) { switch (j) { case 2: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2010, programID, strDQ,CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2010, programID, strDQ, CityID)); } break; case 3: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2011, programID, strDQ, CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2011, programID, strDQ, CityID)); } break; case 4: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2012, programID, strDQ, CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2012, programID, strDQ, CityID)); } break; case 5: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2013, programID, strDQ, CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2013, programID, strDQ, CityID)); } break; case 6: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2014, programID, strDQ, CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2014, programID, strDQ, CityID)); } break; case 7: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2015, programID, strDQ, CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2015, programID, strDQ, CityID)); } break; case 8: obj.Cells[i, j].Formula = "POWER(H" + (i + 1) + " / C" + (i + 1) + ", 1 / 5) - 1"; break; case 9: if (strTitle == "县级供电区") { obj.SetValue(i, j, SelectData(2020, programID, strDQ, CountyID)); } if (strTitle == "市辖供电区") { obj.SetValue(i, j, SelectData(2020, programID, strDQ, CityID)); } break; case 10: obj.Cells[i, j].Formula = "POWER(J" + (i + 1) + " / H" + (i + 1) + ", 1 / 5) - 1"; break; default: break; } } } }
/// <summary> /// 写入数据 /// </summary> /// <param name="obj"></param> /// <param name="IntRow"></param> /// <param name="IntCol"></param> private void WriteData(FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol) { PSP_Substation_Info psi=null; Object Value = null; obj.Columns[11].Locked = false;//建设型式,手写 for(int i=0;i<list.Count;++i) { psi=(PSP_Substation_Info)list[i]; for (int j = 0; j < obj.ColumnCount; ++j) { switch (j) { case 0: Value = psi.Title;//名称 break; case 1: Value = psi.L1;//电压等级(kV) break; case 2: Value = psi.L15;//变比 break; case 3: Value = psi.L4;//容量构成(MVA) break; case 4: Value = psi.L3;//主变台数(台) break; case 5: Value = psi.L2;//总容量(MVA) break; case 6: Value = psi.L9;//最大负荷(MW) break; case 7: Value = psi.L5;//无功补偿容量(Mvar) break; case 8: Value = psi.L13;//10(20)kV出线间隔总数(回) break; case 9: Value = psi.L14;//10(20)已出线间隔数 (回) break; case 10: Value = psi.S4;//公用/专用 break; case 12: Value = psi.S2;//投运时间 break; case 13: Value = psi.AreaName;//所在分区 break; default: break; } if(j!=11) { obj.SetValue(IntRow+i, j, Value);// } } } }
/// <summary> /// 重绘 /// </summary> /// <param name="obj"></param> private void Redraw(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int BeginYear, int EndYear) { list = AddColumnTitle(BeginYear, EndYear); obj.RowCount = 0; obj.ColumnCount = 0; obj.ColumnCount = 1 + (EndYear - BeginYear + 1) + list.Count+1; SelectDQ(FB); int IntRowCount = 1+AreaList.Count + 1 + 2 + 3;//标题占3行,分区类型占2行,1是其它用 string title = null; obj.Rows.Count = IntRowCount; IntCol = obj.Columns.Count; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); string strTitle = ""; IntRow = 3; strTitle = "附表2 铜陵县分镇/片区" + BeginYear + "~" + EndYear + "年人口状况表"; PF.CreateSheetView(obj, IntRow, IntCol, 0, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, 0, strTitle); IntCol = 1; strTitle = "单位:万人、平方公里"; obj.AddSpanCell(IntRow, 0, 1, obj.Columns.Count); obj.SetValue(IntRow, 0, strTitle); //右对齐 obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right; strTitle = " 镇/片区"; PF.CreateSheetView(obj, NextRowMerge += 1, NextColMerge, IntRow += 1, IntCol -= 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "面积"; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, "60"); for (int i = 0; i < AreaList.Count+1; ++i) { if(i!=AreaList.Count) { PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + i + 2), 0, AreaList[i].ToString()); PF.SetSheetViewColumnsWidth(obj, IntCol, AreaList[i].ToString()); } else { PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + i + 2), 0, "合计"); } } NextRowMerge = 1; NextColMerge = 1; IntRow = 5; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
public void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet,string ProjID, List<string[]> SxXjName) { int startrow = 2; string tiaojian = ""; string yeartiaojian = ""; string GYorZB = ""; for (int i = 0; i < SxXjName.Count; i++) { if (SxXjName[i][2] != "合计") { for (int col = 2; col < 9; col++) { //2010年装机容量包括09年及以前的年份 if (col==2) { yeartiaojian = " CAST(S3 as int )<=2010 "; } //2020年装机容量包括2016到2020年 else if (col==8) { yeartiaojian = " CAST(S3 as int ) between 2016 and 2020 "; } //2011到2015每年单独统计 else { yeartiaojian = " CAST(S3 as int )=" + (2008 + col); } //计算装机容量 tiaojian = " AreaID='" + ProjID + "' and S10!='水电' and S10!='煤电' and S10!='' and " + yeartiaojian + " and S5='" + SxXjName[i][2] + "' and CAST(S1 as int) between 10 and 110"; double ZJRLsum = 0; if (Services.BaseService.GetObject("SelectPSP_PowerSubstation_Info_S2", tiaojian) != null) { ZJRLsum = (double)Services.BaseService.GetObject("SelectPSP_PowerSubstation_Info_S2", tiaojian); } obj_sheet.SetValue(startrow + i, col, ZJRLsum); } } else { if (i == 1) { //写入县级合计部分公式 fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + 2, 2, 4, 1, startrow + 1, 2, 7); } else { //写入全地区合计公式 fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow, 2, 2, 1, startrow + i, 2, 7); } } } }
/// <summary> /// 写入数据 /// </summary> /// <param name="obj"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj,string BeginYear) { string strRowTitle = null; string strColTitle = null; for (int i = 6; i < obj.RowCount; ++i) { strRowTitle = (string)PF.ReturnStr(obj, i, 0); for (int j = 1; j < obj.ColumnCount; ++j) { strColTitle = obj.GetValue(4, j).ToString(); if (strRowTitle == "合计") { if (strColTitle == "“十五”年均增速" || strColTitle == "“十一五”年均增速" || strColTitle == "“十二五”年均增速" || strColTitle == "“十三五”年均增速") { if (strColTitle == "“十五”年均增速") { obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j - 1) + (i + 1) + "/" + PF.GetColumnTitle(j - 6) + (i + 1) + ",1/5)-1"; } else { obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j - 1) + (i + 1) + "/" + PF.GetColumnTitle(j - 5) + (i + 1) + ",1/5)-1"; } obj.Cells[i, j].CellType = PC;//% } else { obj.Cells[i, j].Formula = "Sum(" + PF.GetColumnTitle(j) + (i) + ":" + PF.GetColumnTitle(j) + (i - AreaList.Count+1 ) + ")"; //obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j) + (i) + "/" + PF.GetColumnTitle(j) + (i - AreaList.Count + 1) + ",1/" + AreaList.Count + ")-1"; } } else { if (strColTitle == "“十五”年均增速" || strColTitle == "“十一五”年均增速" || strColTitle == "“十二五”年均增速" || strColTitle == "“十三五”年均增速") { if (strColTitle == "“十五”年均增速") { obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j - 1) + (i + 1) + "/" + PF.GetColumnTitle(j - 6) + (i + 1) + ",1/5)-1"; } else { obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j - 1) + (i + 1) + "/" + PF.GetColumnTitle(j - 5) + (i + 1) + ",1/5)-1"; } obj.Cells[i, j].CellType = PC;//% } else { obj.SetValue(i, j, SelectCurrentData(FB, strColTitle, strRowTitle, BeginYear)); } } } } }
public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //���27 ��13 �� rowcount = 27; colcount = 13; //�������һ�еı��� title = TC.GetTableTitle(this.GetType().Name); //�������й���� //int[] TableYearsAry = TC.GetTableYears(this.GetType().Name); //�������� sheetname = title; //�趨����������ֵ������ͱ��� TC.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //�趨����ģʽ���Ա�д��ʽʹ�� TC.Sheet_Referen_R1C1(obj_sheet); //�趨����п�� obj_sheet.Columns[0].Width = 60; obj_sheet.Columns[1].Width = 60; obj_sheet.Columns[2].Width = 100; obj_sheet.Columns[3].Width = 60; obj_sheet.Columns[4].Width = 60; obj_sheet.Columns[5].Width = 60; obj_sheet.Columns[6].Width = 60; obj_sheet.Columns[7].Width = 60; obj_sheet.Columns[8].Width = 60; obj_sheet.Columns[9].Width = 60; obj_sheet.Columns[10].Width = 60; obj_sheet.Columns[11].Width = 100; obj_sheet.Columns[12].Width = 100; //�趨����и߶� obj_sheet.Rows[0].Height = 20; obj_sheet.Rows[1].Height = 20; //д���������� //2�б������� obj_sheet.SetValue(1, 0, "����"); obj_sheet.SetValue(1, 1, "��Ŀ"); obj_sheet.SetValue(1, 2, "���������䣨%��"); obj_sheet.SetValue(1, 3, "<20"); obj_sheet.SetValue(1, 4, "20~40"); obj_sheet.SetValue(1, 5, "40~50"); obj_sheet.SetValue(1, 6, "50~67"); obj_sheet.SetValue(1, 7, "67~75"); obj_sheet.SetValue(1, 8, "75~80"); obj_sheet.SetValue(1, 9, "80~100"); obj_sheet.SetValue(1, 10, ">100"); obj_sheet.SetValue(1, 11, "������·������%��"); obj_sheet.SetValue(1, 12, "������·������%��"); //д���������� //1�б������� obj_sheet.AddSpanCell(2, 0, 8, 1); obj_sheet.SetValue(2, 0, "XX�����أ�"); obj_sheet.AddSpanCell(10, 0, 8, 1); obj_sheet.SetValue(10, 0, "xx�����أ�22"); obj_sheet.AddSpanCell(18, 0, 8, 1); obj_sheet.SetValue(18, 0, "ȫ�кϼ�"); obj_sheet.AddSpanCell(26, 0, 1, 3); obj_sheet.SetValue(26, 0, "�ϼ�"); //2�б������� obj_sheet.AddSpanCell(2, 1, 6, 1); obj_sheet.SetValue(2, 1, "���ͽ��ߣ��أ�"); obj_sheet.AddSpanCell(8, 1, 1, 2); obj_sheet.SetValue(8, 1, "������"); obj_sheet.AddSpanCell(9, 1, 1, 2); obj_sheet.SetValue(9, 1, "�����ǵ��ͽ��ߣ��أ�"); obj_sheet.AddSpanCell(10, 1, 6, 1); obj_sheet.SetValue(10, 1, "���ͽ��ߣ��أ�"); obj_sheet.AddSpanCell(16, 1, 1, 2); obj_sheet.SetValue(16, 1, "������"); obj_sheet.AddSpanCell(17, 1, 1, 2); obj_sheet.SetValue(17, 1, "�����ǵ��ͽ��ߣ��أ�"); obj_sheet.AddSpanCell(18, 1, 6, 1); obj_sheet.SetValue(18, 1, "���ͽ��ߣ��أ�"); obj_sheet.AddSpanCell(24, 1, 1, 2); obj_sheet.SetValue(24, 1, "������"); obj_sheet.AddSpanCell(25, 1, 1, 2); obj_sheet.SetValue(25, 1, "�����ǵ��ͽ��ߣ��أ�"); //3�б������� obj_sheet.SetValue(2, 2, "����һ��"); obj_sheet.SetValue(3, 2, "����һ��"); obj_sheet.SetValue(4, 2, "������"); obj_sheet.SetValue(5, 2, "˫����"); obj_sheet.SetValue(6, 2, "��ֶ�������"); obj_sheet.SetValue(7, 2, "��ֶ�������"); obj_sheet.SetValue(10, 2, "����һ��"); obj_sheet.SetValue(11, 2, "����һ��"); obj_sheet.SetValue(12, 2, "������"); obj_sheet.SetValue(13, 2, "˫����"); obj_sheet.SetValue(14, 2, "��ֶ�������"); obj_sheet.SetValue(15, 2, "��ֶ�������"); obj_sheet.SetValue(18, 2, "����һ��"); obj_sheet.SetValue(19, 2, "����һ��"); obj_sheet.SetValue(20, 2, "������"); obj_sheet.SetValue(21, 2, "˫����"); obj_sheet.SetValue(22, 2, "��ֶ�������"); obj_sheet.SetValue(23, 2, "��ֶ�������"); //������� Sheet_AddData(obj_sheet); //�趨����� TC.Sheet_GridandCenter(obj_sheet); //������� TC.Sheet_Locked(obj_sheet); }
/// <summary> /// 写入列标题 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> /// <param name="BeginYear"></param> /// <param name="EndYear"></param> public void SetColumnsTitle(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int BeginYear, int EndYear) { int intTemp = BeginYear; const int coltemp = 2;//写入列的起始点 Redraw(FB,obj, BeginYear, EndYear); for (int i = BeginYear; i <= (EndYear + list.Count); ++i) { obj.AddSpanCell(4, (i - BeginYear + coltemp), 2, 1); //if(i!=EndYear+list.Count)//和下面eles对应 //{ obj.SetValue(4, (i - BeginYear + coltemp), intTemp); if (i == 2006) { obj.SetValue(4, (i - BeginYear + coltemp), "“十五”年均增速"); intTemp--; } if (i == (2011 + 1))//中间空一行所以加一 { obj.SetValue(4, (i - BeginYear + coltemp), "“十一五”年均增速"); intTemp--; } if (i == (2016 + 2)) { obj.SetValue(4, (i - BeginYear + coltemp), "“十二五”年均增速"); intTemp--; } if (i == (2021 + 3)) { obj.SetValue(4, (i - BeginYear + coltemp), "“十三五”年均增速"); intTemp--; } //} //else//这是预计的列现在先不用 //{ // if (i != 2006 && i != (2011 + 1) && i != (2016 + 2) && i != (2021 + 3)) // { // obj.SetValue(4, (i - BeginYear + 1), intTemp + "预计"); // } // else // { // if (i == 2006) // { // obj.SetValue(4, (i - BeginYear + 1), "“十五”年均增速"); // intTemp--; // } // if (i == (2011 + 1))//中间空一行所以加一 // { // obj.SetValue(4, (i - BeginYear + 1), "“十一五”年均增速"); // intTemp--; // } // if (i == (2016 + 2)) // { // obj.SetValue(4, (i - BeginYear + 1), "“十二五”年均增速"); // intTemp--; // } // if (i == (2021 + 3)) // { // obj.SetValue(4, (i - BeginYear + 1), "“十三五”年均增速"); // intTemp--; // } // } //} intTemp++; } list.Clear(); WriteData(FB, obj, BeginYear.ToString()); }
/// <summary> /// 左侧标题 /// </summary> /// <param name="obj"></param> /// <param name="IntRow"></param> /// <param name="IntCol"></param> private void SetLeftTitle(FarPoint.Win.Spread.SheetView obj, int IntRow,int IntCol) { IList list=null; int index = 0; PF.CreateSheetView(obj, AreaName[0].Count*VoltileClass, 1, IntRow, IntCol , "市辖供电区"); PF.CreateSheetView(obj, AreaName[1].Count*VoltileClass, 1, IntRow+AreaName[0].Count*VoltileClass, IntCol , "县级供电区"); list=AreaName[0]; for(int i=0;i<AreaName[0].Count*VoltileClass;i+=2) { PF.CreateSheetView(obj, VoltileClass, 1, IntRow + i, 1, list[index].ToString()); for(int j=0;j<VoltileClass;++j) { obj.SetValue(IntRow + i + j, 2, strVoleitleClass[j]); } index++; } list=AreaName[1]; index = 0; for(int i=0;i<AreaName[1].Count*VoltileClass;i+=2) { PF.CreateSheetView(obj, VoltileClass, 1, IntRow + AreaName[0].Count * VoltileClass + i, 1, list[index].ToString()); for (int j = 0; j < VoltileClass; ++j) { obj.SetValue(IntRow + AreaName[0].Count * VoltileClass + i + j, 2, strVoleitleClass[j]); } index++; } }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet, List<string[]> SxXjName, IList<string> obj_DY_List) { //写标题行内容 //2行标题内容 obj_sheet.SetValue(1, 0, "编号"); obj_sheet.SetValue(1, 1, "类型"); obj_sheet.SetValue(1, 2, "低压线路类型"); obj_sheet.SetValue(1, 3, "导线截面(mm2)"); //写标题列内容 int startrow = 2; //添加列标题内容 int dylength = obj_DY_List.Count; if (obj_DY_List.Count > 0) { for (int i = 0; i < SxXjName.Count; i++) { for (int j = 0; j < obj_DY_List.Count; j++) { obj_sheet.SetValue(startrow + i * dylength + j, 2, obj_DY_List[j].ToString()); } obj_sheet.AddSpanCell(startrow + i * dylength, 0, dylength, 1); obj_sheet.SetValue(startrow + i * dylength, 0, SxXjName[i][0].ToString()); obj_sheet.AddSpanCell(startrow + i * dylength, 1, dylength, 1); obj_sheet.SetValue(startrow + i * dylength, 1, SxXjName[i][1].ToString()); } } }
private void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet, int year, string ProjID, IList<double> obj_DY_List, IList<string> SXareaid_List, IList<string> XJareaid_List) { //条件 string XLtiaojian = ""; //DQ条件 string DQtiaojian = ""; int startrow = 2; int length = obj_DY_List.Count; if (obj_DY_List.Count > 0) { for (int i = 0; i < (2 + SXareaid_List.Count + XJareaid_List.Count); i++) { string areaid = ""; if (i != 0 && i != (SXareaid_List.Count + 1)) { if (i < SXareaid_List.Count + 1) { DQtiaojian = " DQ='市辖供电区'"; areaid = SXareaid_List[i - 1].ToString(); } else { DQtiaojian = " DQ!='市辖供电区'"; areaid = XJareaid_List[i - SXareaid_List.Count - 2].ToString(); } for (int j = 0; j < obj_DY_List.Count; j++) { XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and Length2>=LineLength and ProjectID='" + ProjID + "' and Type='05' and LineType2='公用' and " + DQtiaojian + " and AreaID='" + areaid + "' and RateVolt=" + obj_DY_List[j].ToString(); //线路条数 int XLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian) != null) { XLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian); } obj_sheet.SetValue(startrow + i * length + j, 3, XLsum); //环网线路条数 string hwxltiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and Length2>=LineLength and JXFS='环网' and ProjectID='" + ProjID + "' and Type='05' and LineType2='公用' and " + DQtiaojian + " and AreaID='" + areaid + "' and RateVolt=" + obj_DY_List[j].ToString(); int HWXLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", hwxltiaojian) != null) { HWXLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", hwxltiaojian); } obj_sheet.SetValue(startrow + i * length + j, 4, HWXLsum); //双射线路条数 string ssxltiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and Length2>=LineLength and (JXFS='放射型' or JXFS='T型') and ProjectID='" + ProjID + "' and Type='05' and LineType2='公用' and " + DQtiaojian + " and AreaID='" + areaid + "' and RateVolt=" + obj_DY_List[j].ToString(); int SSXLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", ssxltiaojian) != null) { SSXLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", ssxltiaojian); } obj_sheet.SetValue(startrow + i * length + j, 5, SSXLsum); //单射线路条数 string dsxltiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and Length2>=LineLength and JXFS='链式' and ProjectID='" + ProjID + "' and Type='05' and LineType2='公用' and " + DQtiaojian + " and AreaID='" + areaid + "' and RateVolt=" + obj_DY_List[j].ToString(); int DSXLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", dsxltiaojian) != null) { DSXLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", dsxltiaojian); } obj_sheet.SetValue(startrow + i * length + j, 6, DSXLsum); //其它结构线路条数 string qtllxltiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and Length2>=LineLength and JXFS='其它' and ProjectID='" + ProjID + "' and Type='05' and LineType2='公用' and " + DQtiaojian + " and AreaID='" + areaid + "' and RateVolt=" + obj_DY_List[j].ToString(); int QTXLsum = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", qtllxltiaojian) != null) { QTXLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", qtllxltiaojian); } obj_sheet.SetValue(startrow + i * length + j, 7, QTXLsum); } } else { //市辖合计部分公式 if (i == 0) { if (SXareaid_List.Count != 0) { fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + (i + 1) * length, 3, SXareaid_List.Count, length, startrow + i * length, 3, 5); } //无地区直接在合计部分写0 else { fc.Sheet_WriteZero(obj_sheet, startrow + i * length, 3, length, 5); } } //县级合计部分公式 else { if (XJareaid_List.Count != 0) { fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + (i + 1) * length, 3, XJareaid_List.Count, length, startrow + i * length, 3, 5); } //无地区直接在合计部分写0 else { fc.Sheet_WriteZero(obj_sheet, startrow + i * length, 3, length, 5); } } } } } }
private void WriteData(FarPoint.Win.Spread.SheetView obj,int IntRow) { Ps_Table_TZGS ptz = null; int index = 1; for(int i=0;i<Llist.Count;++i)//低压 { ptz = (Ps_Table_TZGS)Llist[i]; for(int j=0;j<obj.ColumnCount;++j) { switch (j) { case 0://序号 obj.SetValue((i + IntRow), j, index); break; case 1://项目 obj.SetValue((i + IntRow), j, ptz.Title); break; case 2://项目性质 obj.SetValue((i + IntRow), j, ptz.Col3); break; case 3://建设年限 obj.SetValue((i + IntRow), j, ptz.BuildEd); break; case 4://建设内容 obj.SetValue((i + IntRow), j, ptz.Col1); break; case 5://资金 obj.SetValue((i + IntRow), j, ptz.Amount); break; default: break; } } index++; } for (int i = 0; i < HList.Count; ++i)//高压 { ptz = (Ps_Table_TZGS)HList[i]; for (int j = 0; j < obj.ColumnCount; ++j) { switch (j) { case 0://序号 obj.SetValue((i + IntRow+Llist.Count), j, index); break; case 1://项目 obj.SetValue((i + IntRow + Llist.Count), j, ptz.Title); break; case 2://项目性质 obj.SetValue((i + IntRow + Llist.Count), j, ptz.Col3); break; case 3://建设年限 obj.SetValue((i + IntRow + Llist.Count), j, ptz.BuildEd); break; case 4://建设内容 obj.SetValue((i + IntRow + Llist.Count), j, ptz.Col1); break; case 5://资金 obj.SetValue((i + IntRow + Llist.Count), j, ptz.Amount); break; default: break; } } index++; } }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet,Hashtable area_key_id, IList<string> obj_DY_List, IList<string> SXareaid_List, IList<string> XJareaid_List) { //写标题行内容 //2行标题内容 obj_sheet.SetValue(1, 0, "分区类型"); obj_sheet.SetValue(1, 1, "分区名称"); obj_sheet.SetValue(1, 2, "低压线路类型"); obj_sheet.SetValue(1, 3, "导线截面(mm2)"); //写标题列内容 int dylength = obj_DY_List.Count; int startrow = 2; for (int i = 0; i < (2 + SXareaid_List.Count + XJareaid_List.Count); i++) { string areaname = ""; if (i == 0 || i == (SXareaid_List.Count + 1)) { areaname = "合计"; } else { if (i < SXareaid_List.Count + 1) { if (area_key_id[SXareaid_List[i - 1].ToString()] != null) { areaname = area_key_id[SXareaid_List[i - 1].ToString()].ToString(); } else { areaname = ""; } } else { if (area_key_id[XJareaid_List[i - SXareaid_List.Count - 2].ToString()] != null) { areaname = area_key_id[XJareaid_List[i - SXareaid_List.Count - 2].ToString()].ToString(); } else { areaname = ""; } } } for (int j = 0; j < obj_DY_List.Count; j++) { obj_sheet.SetValue(startrow + i * dylength + j, 2, obj_DY_List[j].ToString()); } obj_sheet.AddSpanCell(startrow + i * dylength, 1, dylength, 1); obj_sheet.SetValue(startrow + i * dylength, 1, areaname); } //写第一列数据 obj_sheet.AddSpanCell(startrow, 0, (SXareaid_List.Count + 1)*dylength, 1); obj_sheet.SetValue(startrow, 0, "市辖供电区"); obj_sheet.AddSpanCell(startrow + (SXareaid_List.Count + 1) * dylength, 0, (XJareaid_List.Count + 1) * dylength, 1); obj_sheet.SetValue(startrow + (SXareaid_List.Count + 1) * dylength, 0, "县级供电区"); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_25Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int Temp = 0; int IntColCount = 6; SelectData(FB); int IntRowCount = HList.Count+Llist.Count+1 + 2 + 3;//标题占3行,分区类型占2行 int BringIntoPproductionTime = 6;//投产时间的列数 string title = null; obj.SheetName = Title; obj.Columns.Count = IntColCount; obj.Rows.Count = IntRowCount; IntCol = obj.Columns.Count; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); string strTitle = ""; IntRow = 3; strTitle = Title; PF.CreateSheetView(obj, IntRow, IntCol, 0, 0, Title); PF.SetSheetViewColumnsWidth(obj, 0, Title); IntCol = 1; strTitle = " 单位:亿元"; obj.AddSpanCell(IntRow, 0, 1, obj.Columns.Count); obj.SetValue(IntRow, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, 0, strTitle); //右对齐 obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right; //列标题 IntRow = 4; strTitle = "序 号"; PF.CreateSheetView(obj, NextRowMerge += 1, NextColMerge, IntRow, IntCol -= 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "项 目"; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "项目性质"; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "建设年限"; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "建设内容"; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "资 金"; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 //SetLeftTitle(); WriteData(obj,IntRow); }
private void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet, int year, string ProjID) { //断路器的电压取它所链接的母线的电压,公用或专用取母线所属变电站的公用或专用 //将类型存入数组,便于读取 string[] dq ={ "市辖供电区", "县级直供直管", "县级控股", "县级参股", "县级代管" }; //存放读出的类型 string dqstr = ""; //存便电站电压条件 string BDdianya = ""; //存断路器电压条件 string DLQdianya = ""; //存放变电站查询条件 string BDtiaojian = ""; //存放断路器查询条件 string DLQtiaojian = ""; string yeartiaojian=""; //存放公用还是专用 //string GorZ = ""; //定义初始行数 int startrow = 3; int row = 0; int length = 10; for (int i = 0; i < 5; i++) { if (i > 0) { row = startrow + (i + 1) * length; } else { row = startrow + i * length; } dqstr = dq[i]; //固定循环2次,一次求电压110(66),一次求电压为35 for (int j = 0; j < 2; j++) { if (j == 0) { BDdianya = " and (L1=110 or L1=66) "; DLQdianya = " and (b.RateVolt=110 or b.RateVolt=66)"; } else { BDdianya = " and L1=35 "; DLQdianya = " and b.RateVolt=35 "; } //固定循环5次,计算相应的年份 for (int k = 1; k <= 5; k++) { if (k == 1) { yeartiaojian = " between 0 and 5 "; } if (k > 1 && k < 5) { yeartiaojian = " between " + ((k - 1) * 5 + 1) + " and " + k * 5; } if (k == 5) { yeartiaojian = " >20 "; } //各年主变台数 BDtiaojian = " S2!='' and (" + year + "-cast(substring(S2,1,4) as int) )"+yeartiaojian+" and AreaID='" + ProjID + "' and DQ='" + dqstr + "' and S4='公用' " + BDdianya; int ZBsum = 0; if (Services.BaseService.GetObject("SelectPSP_Substation_InfoSUML3", BDtiaojian) != null) { ZBsum = (int)Services.BaseService.GetObject("SelectPSP_Substation_InfoSUML3", BDtiaojian); } obj_sheet.SetValue(row+k-1, 4, ZBsum); //各年 断路器台数 DLQtiaojian = " a.OperationYear!='' and (" + year + "-cast(a.OperationYear as int) )"+yeartiaojian+" and a.ProjectID='" + ProjID + "' and a.DQ='" + dqstr + "' and a.Type='06' " + DLQdianya; int DLQsum1 = 0; if (Services.BaseService.GetObject("SelectPSPDEV_CountDLQ", DLQtiaojian) != null) { DLQsum1 = (int)Services.BaseService.GetObject("SelectPSPDEV_CountDLQ", DLQtiaojian); } obj_sheet.SetValue(row+k-1, 6, DLQsum1); } row = row + 5; } } }
/// <summary> /// 写入数据 /// </summary> /// <param name="obj"></param> /// <param name="IntRow"></param> /// <param name="IntCol"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol) { PSPDEV psDev = null; Object Value = null; for (int i = 0; i < list.Count; ++i) { psDev = (PSPDEV)list[i]; SelectBDZ(FB, psDev.Name); for (int j = 0; j < obj.ColumnCount; ++j) { switch (j) { case 0: Value = i + 1;//序号 break; case 1: Value = psDev.Name;//中压线路名 break; case 2: if (BDZ == null) { Value = "";//BDZ1.Title; } else if (BDZ1 == null) { Value = "";// BDZ.Title; } else { Value = BDZ.Title + "," + BDZ1.Title;//变电站名 } break; case 3: Value = psDev.RateVolt;//电压等级(kV) break; case 4: Value = psDev.LineType2;//线路属性 break; case 5://*************************************** //干线长度(km)(A),手写 break; case 6: Value = psDev.Length2 + psDev.LineLength;//线路总长度(km) break; case 7: Value = psDev.Length2;//电缆线路长度(km) break; case 8: Value = psDev.LineLength;//架空线路长度(km) break; case 9: Value = psDev.LineType;//主干线型号 break; case 10: if (psDev.LineLength > psDev.Length2) Value = "架空";//架设方式 else Value = "电缆"; break; case 11: Value = psDev.Burthen * 1000;//最大电流(A) break; case 12: Value =psDev.OperationYear;//线路投运时间 break; default: break; } if(j==obj.ColumnCount-1||j==5) { obj.Cells[IntRow + i, j].Locked = false; } else { obj.SetValue(IntRow + i, j, Value);// } } } }