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.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, 1, 2); obj_sheet.SetValue(1, 3, "线路条数(条)"); obj_sheet.AddSpanCell(1, 5, 1, 2); obj_sheet.SetValue(1, 5, "线路总长度(km)"); obj_sheet.AddSpanCell(1, 7, 1, 2); obj_sheet.SetValue(1, 7, "其中:电缆长度(km)"); obj_sheet.SetValue(1, 9, "平均线路长度(km)"); obj_sheet.SetValue(1, 10, "主干线长度(km)"); obj_sheet.SetValue(1, 11, "主干平均长度(km)"); obj_sheet.SetValue(1, 12, "主干长度>4km条数(条)"); obj_sheet.SetValue(1, 13, "主干长度>10km条数(条)"); obj_sheet.AddSpanCell(1, 14, 1, 2); obj_sheet.SetValue(1, 14, "平均单条线路配变装接容量(MVA/条)"); obj_sheet.AddSpanCell(1, 16, 1, 2); obj_sheet.SetValue(1, 16, "线路配变装接容量>12MVA线路条数(条)"); obj_sheet.SetValue(1, 18, "架空线绝缘导线长度(km)"); obj_sheet.SetValue(1, 19, "架空线路绝缘化率(%)"); obj_sheet.SetValue(1, 20, "电缆化率(%)"); //3行标题内容 obj_sheet.SetValue(2, 3, "公用"); obj_sheet.SetValue(2, 4, "专用"); 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, "公用"); obj_sheet.SetValue(2, 19, "公用"); obj_sheet.SetValue(2, 20, "公用"); //写标题列内容 fc.Sheet_AddItem_FBonlyDY(obj_sheet, area_key_id, 3, obj_DY_List, SXareaid_List, XJareaid_List); }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet, int row, string dq) { 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"); obj_sheet.AddSpanCell(row, 1, 10, 1); obj_sheet.SetValue(row, 1, dq); }
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, 1, 2); obj_sheet.SetValue(1, 2, "330kV"); obj_sheet.AddSpanCell(1, 4, 1, 2); obj_sheet.SetValue(1, 4, "220kV"); //3行标题内容 obj_sheet.SetValue(2, 2, "公用"); obj_sheet.SetValue(2, 3, "专用"); obj_sheet.SetValue(2, 4, "公用"); obj_sheet.SetValue(2, 5, "专用"); //写标题列内容 //1列标题内容 obj_sheet.AddSpanCell(3, 0, 3, 1); obj_sheet.SetValue(3, 0, "变电"); obj_sheet.AddSpanCell(6, 0, 3, 1); obj_sheet.SetValue(6, 0, "线路"); //2列标题内容 obj_sheet.SetValue(3, 1, "变电站座数(座)"); obj_sheet.SetValue(4, 1, "主变台数(台)"); obj_sheet.SetValue(5, 1, "变电容量(MVA)"); obj_sheet.SetValue(6, 1, "架空(km)"); obj_sheet.SetValue(7, 1, "电缆(km)"); obj_sheet.SetValue(8, 1, "合计"); }
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, "电压等级(kV)"); obj_sheet.AddSpanCell(1, 5, 1, 7); obj_sheet.SetValue(1, 5, "装机容量(MW)"); //3行标题内容 obj_sheet.SetValue(2, 5, "2010年"); obj_sheet.SetValue(2, 6, "2011年"); obj_sheet.SetValue(2, 7, "2012年"); obj_sheet.SetValue(2, 8, "2013年"); obj_sheet.SetValue(2, 9, "2014年"); obj_sheet.SetValue(2, 10, "2015年"); obj_sheet.SetValue(2, 11, "2020年"); }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet, List <string[]> SxXjName, IList <double> obj_DY_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, 1, 2); obj_sheet.SetValue(1, 2, "配变低压侧补偿"); obj_sheet.AddSpanCell(1, 4, 1, 2); obj_sheet.SetValue(1, 4, "中压线路补偿"); obj_sheet.AddSpanCell(1, 6, 2, 1); obj_sheet.SetValue(1, 6, "无功补偿总容量(Mvar)"); //3行标题内容 obj_sheet.SetValue(2, 2, "配变总台数(台)"); obj_sheet.SetValue(2, 3, "无功补偿容量(Mvar)"); obj_sheet.SetValue(2, 4, "线路条数(条)"); obj_sheet.SetValue(2, 5, "无功补偿容量(Mvar)"); //写标题列内容 //1列标题内容 obj_sheet.SetValue(3, 0, "1"); obj_sheet.SetValue(4, 0, "2"); obj_sheet.SetValue(5, 0, "2.1"); obj_sheet.SetValue(6, 0, "2.2"); obj_sheet.SetValue(7, 0, "2.3"); obj_sheet.SetValue(8, 0, "2.4"); obj_sheet.SetValue(9, 0, "3"); //2列标题内容 obj_sheet.SetValue(3, 1, "市辖供电区"); obj_sheet.SetValue(4, 1, "县级供电区"); obj_sheet.SetValue(5, 1, "其中:直供直管"); obj_sheet.SetValue(6, 1, "控股"); obj_sheet.SetValue(7, 1, "参股"); obj_sheet.SetValue(8, 1, "代管"); obj_sheet.SetValue(9, 1, "全地区"); }
private void AddItems(FarPoint.Win.Spread.SheetView obj_sheet, string Area, int rowstart) { obj_sheet.AddSpanCell(rowstart, 0, 9, 1); obj_sheet.SetValue(rowstart, 0, Area); obj_sheet.SetValue(rowstart++, 1, "国内生产总值(亿元)"); obj_sheet.SetValue(rowstart++, 1, "第一产业"); obj_sheet.SetValue(rowstart++, 1, "第二产业"); obj_sheet.SetValue(rowstart++, 1, "第三产业"); obj_sheet.SetValue(rowstart++, 1, "人口(万人)"); obj_sheet.SetValue(rowstart++, 1, "人均GDP(万元)"); obj_sheet.SetValue(rowstart++, 1, "行政面积(平方千米)"); obj_sheet.SetValue(rowstart++, 1, "建成区面积(平方千米)"); obj_sheet.SetValue(rowstart++, 1, "城镇化率(%)"); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_8Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int IntColCount = 1; 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); NextRowMerge = 1; NextColMerge = 1; IntRow = 5; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
/// <summary> /// 写入列标题 /// </summary> /// <param name="obj"></param> private void SetColtitle(FarPoint.Win.Spread.SheetView obj, int IntRow) { int intTitle = 2000; int temp = 0; string strTitle = "“十五”年均增长率"; for (int j = 2; j < obj.ColumnCount; ++j) { if (j == 8) { obj.SetValue(IntRow, j, strTitle); obj.SetColumnWidth(j, (strTitle.Length * 13)); } else { obj.SetValue(IntRow, j, intTitle); intTitle++; } obj.AddSpanCell(IntRow, j, 2, 1); } }
private void Sheet_AddItem(FarPoint.Win.Spread.SheetView obj_sheet) { //写标题行内容 //2行标题内容 obj_sheet.SetValue(1, 0, "结构类型"); obj_sheet.SetValue(1, 1, "项目"); obj_sheet.SetValue(1, 2, "110kV高压配电网"); obj_sheet.SetValue(1, 3, "35kV高压配电网"); //写标题列内容 //1列标题内容 obj_sheet.AddSpanCell(2, 0, 2, 1); obj_sheet.SetValue(2, 0, "环网"); obj_sheet.AddSpanCell(4, 0, 2, 1); obj_sheet.SetValue(4, 0, "放射型"); obj_sheet.AddSpanCell(6, 0, 2, 1); obj_sheet.SetValue(6, 0, "链式"); obj_sheet.AddSpanCell(8, 0, 2, 1); obj_sheet.SetValue(8, 0, "T型"); obj_sheet.AddSpanCell(10, 0, 2, 1); obj_sheet.SetValue(10, 0, "其它"); obj_sheet.AddSpanCell(12, 0, 2, 1); obj_sheet.SetValue(12, 0, "合计"); //2列标题内容 obj_sheet.SetValue(2, 1, "该结构中线路条数(条)"); obj_sheet.SetValue(3, 1, "线路条数所占比例(%)"); obj_sheet.SetValue(4, 1, "该结构中线路条数(条)"); obj_sheet.SetValue(5, 1, "线路条数所占比例(%)"); obj_sheet.SetValue(6, 1, "该结构中线路条数(条)"); obj_sheet.SetValue(7, 1, "线路条数所占比例(%)"); obj_sheet.SetValue(8, 1, "该结构中线路条数(条)"); obj_sheet.SetValue(9, 1, "线路条数所占比例(%)"); obj_sheet.SetValue(10, 1, "该结构中线路条数(条)"); obj_sheet.SetValue(11, 1, "线路条数所占比例(%)"); obj_sheet.SetValue(12, 1, "线路总条数(条)"); obj_sheet.SetValue(13, 1, "线路条数所占比例(%)"); }
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); }
//此处为动态添加数据方法 private void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet) { int startrow = 3; int addnum = 0; int itemcount = 0; int firstrow = 0; string rowsum = ""; string rowsum2 = ""; Itop.Domain.PWTable.PW_tb3a p = new Itop.Domain.PWTable.PW_tb3a(); p.col2 = Itop.Client.MIS.ProgUID; IList <PW_tb3a> list = Services.BaseService.GetList <PW_tb3a>("SelectPW_tb3aBy2254", p); bool sheetEnd = false; for (int i = 0; i < list.Count; i++) { PW_tb3a obj = list[i]; PW_tb3a obj2 = new PW_tb3a(); if (i < list.Count - 1) { obj2 = list[i + 1]; } else { sheetEnd = true; } decimal _sum = obj.Num1 + obj.Num2 + obj.Num3 + obj.Num4 + obj.Num5 + obj.Num6 + obj.Num7 + obj.Num8; itemcount = itemcount + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, obj.PQName); obj_sheet.SetValue(i + addnum + startrow, 1, "线路回数(回)"); obj_sheet.SetValue(i + addnum + startrow, 2, obj.Num1); obj_sheet.SetValue(i + addnum + startrow, 3, obj.Num2); obj_sheet.SetValue(i + addnum + startrow, 4, obj.Num3); obj_sheet.SetValue(i + addnum + startrow, 5, obj.Num4); obj_sheet.SetValue(i + addnum + startrow, 6, obj.Num5); obj_sheet.SetValue(i + addnum + startrow, 7, obj.Num6); obj_sheet.SetValue(i + addnum + startrow, 8, obj.Num7); obj_sheet.SetValue(i + addnum + startrow, 9, obj.Num8); obj_sheet.SetValue(i + addnum + startrow, 10, _sum); itemcount = itemcount + 1; addnum = addnum + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, obj.PQName); obj_sheet.SetValue(i + addnum + startrow, 1, "所占比例(%)"); if (_sum == 0) { obj_sheet.SetValue(i + addnum + startrow, 2, "0"); obj_sheet.SetValue(i + addnum + startrow, 3, "0"); obj_sheet.SetValue(i + addnum + startrow, 4, "0"); obj_sheet.SetValue(i + addnum + startrow, 5, "0"); obj_sheet.SetValue(i + addnum + startrow, 6, "0"); obj_sheet.SetValue(i + addnum + startrow, 7, "0"); obj_sheet.SetValue(i + addnum + startrow, 8, "0"); obj_sheet.SetValue(i + addnum + startrow, 9, "0"); obj_sheet.SetValue(i + addnum + startrow, 10, "0"); } else { obj_sheet.SetValue(i + addnum + startrow, 2, Convert.ToDecimal((obj.Num1 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 3, Convert.ToDecimal((obj.Num2 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 4, Convert.ToDecimal((obj.Num3 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 5, Convert.ToDecimal((obj.Num4 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 6, Convert.ToDecimal((obj.Num5 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 7, Convert.ToDecimal((obj.Num6 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 8, Convert.ToDecimal((obj.Num7 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 9, Convert.ToDecimal((obj.Num8 / _sum) * 100).ToString("0.##")); obj_sheet.SetValue(i + addnum + startrow, 10, "100"); } obj_sheet.AddSpanCell(i + addnum + startrow - 1, 0, 2, 1); rowsum = rowsum + Convert.ToString(startrow - 2 + 2 * (i + 1)) + ","; rowsum2 = rowsum2 + Convert.ToString(startrow - 1 + 2 * (i + 1)) + ","; if (sheetEnd) { addnum = addnum + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, "全市合计"); obj_sheet.SetValue(i + addnum + startrow, 1, "线路回数(回)"); TC.Sheet_WriteFormula_RowSum3(obj_sheet, TC.getRowList(rowsum), 2, i + addnum + startrow, 2, 9); addnum = addnum + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, "全市合计"); obj_sheet.SetValue(i + addnum + startrow, 1, "所占比例(%)"); //TC.Sheet_WriteFormula_TwoCol_Percent(obj_sheet, i + addnum + startrow - 1, 2, 7, 1, i + addnum + startrow, 2); obj_sheet.SetValue(i + addnum + startrow, 10, "100"); obj_sheet.AddSpanCell(i + addnum + startrow - 1, 0, 2, 1); } } }
//此处为动态添加数据方法 private void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet) { int startrow = 3; 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> list = Services.BaseService.GetList <PW_tb3a>("SelectPW_tb3aBy2251", p); PW_tb3c p3 = new PW_tb3c(); p3.col4 = Itop.Client.MIS.ProgUID; IList <PW_tb3c> plist = Services.BaseService.GetList <PW_tb3c>("SelectPW_tb3cList", p3); IList <PW_tb3a> alist = Services.BaseService.GetList <PW_tb3a>("SelectPW_tb3aListDIS", p); for (int n = 0; n < plist.Count; n++) { rowsum.Add(""); } bool sheetEnd = false; for (int i = 0; i < list.Count; i++) { PW_tb3a obj = list[i]; PW_tb3a obj2 = new PW_tb3a(); if (i < list.Count - 1) { obj2 = list[i + 1]; } else { sheetEnd = true; } itemcount = itemcount + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, obj.PQName); obj_sheet.SetValue(i + addnum + startrow, 1, obj.PQtype); obj_sheet.SetValue(i + addnum + startrow, 2, obj.Num10); obj_sheet.SetValue(i + addnum + startrow, 3, obj.Num3); obj_sheet.SetValue(i + addnum + startrow, 4, obj.Num2); obj_sheet.SetValue(i + addnum + startrow, 5, obj.Num4); obj_sheet.SetValue(i + addnum + startrow, 6, obj.KggNum); obj_sheet.SetValue(i + addnum + startrow, 7, obj.KG); obj_sheet.SetValue(i + addnum + startrow, 8, obj.KgzHwNum); obj_sheet.SetValue(i + addnum + startrow, 9, obj.Num11); // obj_sheet.SetValue(i + 3, 10, 1); if (obj.PQName != obj2.PQName) { addnum = addnum + 1; for (int x = 0; x < rowsum.Count; x++) { string str = (string)rowsum[x]; str = str + Convert.ToString(i + addnum + startrow - x - 1) + ","; rowsum[x] = str; } obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, obj.PQName); obj_sheet.SetValue(i + addnum + startrow, 1, "小计"); int num1 = startrow + addnum + firstrow; if (firstrow == 0) { num1 = num1 - 1; } TC.Sheet_WriteFormula_RowSum(obj_sheet, num1, 2, itemcount, 1, i + addnum + startrow, 2, 8); obj_sheet.AddSpanCell(num1, 0, itemcount + 1, 1); firstrow = i; startrow = 3; itemcount = 0; } if (sheetEnd) { int[] sum = new int[plist.Count]; rowsum.Reverse(); for (int m = 0; m < plist.Count; m++) { PW_tb3c _p = plist[m]; addnum = addnum + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, "全市合计"); obj_sheet.SetValue(i + addnum + startrow, 1, _p.col1); sum[m] = i + addnum + startrow; int num1 = startrow + addnum + firstrow; //if (firstrow == 0) { num1 = num1 - 1; } TC.Sheet_WriteFormula_RowSum3(obj_sheet, TC.getRowList(rowsum[m].ToString()), 2, i + addnum + startrow, 2, 8); } addnum = addnum + 1; obj_sheet.RowCount = obj_sheet.RowCount + 1; obj_sheet.SetValue(i + addnum + startrow, 0, "全市合计"); obj_sheet.SetValue(i + addnum + startrow, 1, "总计"); TC.Sheet_WriteFormula_RowSum3(obj_sheet, sum, 2, i + addnum + startrow, 2, 8); obj_sheet.AddSpanCell(sum[0], 0, sum.Length + 1, 1); } } }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_11Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int IntColCount = 8; SelectedBDZ(FB); int IntRowCount = list.Count + 1 + 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; case 2: strTitle = " 主变容量 "; break; case 3: strTitle = " N-1需转移的负荷 "; break; case 4: strTitle = " 联络线路可转带负荷 "; break; case 5: strTitle = " 主变能转带负荷 "; break; case 6: strTitle = " 是否通过校验 "; break; case 7: strTitle = " 损失负荷 "; break; default: break; } 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);//行高 WriteData(FB, obj, IntRow); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_19Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int RowStep = 3; int IntColCount = 2 + 8; int IntRowCount = 23 + 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, obj.Columns.Count, IntRow += 1, IntCol -= 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left; strTitle = "电 量 "; PF.CreateSheetView(obj, NextRowMerge += 3, NextColMerge, IntRow += 1, IntCol, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "负 荷 "; PF.CreateSheetView(obj, 3, NextColMerge, IntRow += 4, IntCol, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); IntRow = 5; strTitle = " 方 案 "; PF.CreateSheetView(obj, 1, NextColMerge, (IntRow), 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); for (int i = 0; i < 2; i++) { strTitle = " 高 "; PF.CreateSheetView(obj, 1, 1, (IntRow + 1 + i * RowStep), 1, strTitle); strTitle = " 中 "; PF.CreateSheetView(obj, 1, 1, (IntRow + 2 + i * RowStep), 1, strTitle); strTitle = " 低 "; PF.CreateSheetView(obj, 1, 1, (IntRow + 3 + i * RowStep), 1, strTitle); } //strTitle = " 方 案 "; //PF.CreateSheetView(obj, 1, NextColMerge, (IntRow ), 2, strTitle); //PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //东部地区 IntRow = 12; strTitle = "东部地区 "; PF.CreateSheetView(obj, 1, obj.Columns.Count, IntRow, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left; strTitle = "电 量 "; PF.CreateSheetView(obj, 1, 2, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "负 荷 "; PF.CreateSheetView(obj, 1, 2, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //南部地区 IntRow = 12 + 3; strTitle = "南部地区 "; PF.CreateSheetView(obj, 1, obj.Columns.Count, IntRow, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left; strTitle = "电 量 "; PF.CreateSheetView(obj, 1, 2, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "负 荷 "; PF.CreateSheetView(obj, 1, 2, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //网供口径 IntRow = 12 + 3 + 3; strTitle = "网供口径 "; PF.CreateSheetView(obj, 1, obj.Columns.Count, IntRow, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left; strTitle = "电 量 "; PF.CreateSheetView(obj, 3, 1, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "负 荷 "; PF.CreateSheetView(obj, 3, 1, IntRow += 3, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); IntRow = 12 + 3 + 3 + 1; RowStep = 3; for (int i = 0; i < 2; i++) { strTitle = " 高 "; PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + i * RowStep), 1, strTitle); strTitle = " 中 "; PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + 1 + i * RowStep), 1, strTitle); strTitle = " 低 "; PF.CreateSheetView(obj, 1, NextColMerge, (IntRow + 2 + i * RowStep), 1, strTitle); } //中部地区 IntRow = 12 + 3 + 3 + 7; strTitle = "中部地区 "; PF.CreateSheetView(obj, 1, obj.Columns.Count, IntRow, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); //obj.Rows[IntRow].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left; strTitle = "电 量 "; PF.CreateSheetView(obj, 1, 2, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "负 荷 "; PF.CreateSheetView(obj, 1, 2, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); NextRowMerge = 1; NextColMerge = 1; IntRow = 5; IntCol = 0; AddColumnTitle(obj, IntRow); //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //表格共12 行11 列 rowcount = 12; 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 = 80; obj_sheet.Columns[1].Width = 80; obj_sheet.Columns[2].Width = 80; obj_sheet.Columns[3].Width = 80; obj_sheet.Columns[4].Width = 80; obj_sheet.Columns[5].Width = 80; obj_sheet.Columns[6].Width = 80; obj_sheet.Columns[7].Width = 80; obj_sheet.Columns[8].Width = 80; obj_sheet.Columns[9].Width = 80; obj_sheet.Columns[10].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.SetValue(1, 0, "分区"); obj_sheet.AddSpanCell(1, 1, 2, 1); obj_sheet.SetValue(1, 1, "供电区分类"); obj_sheet.AddSpanCell(1, 2, 1, 7); obj_sheet.SetValue(1, 2, "公用馈线"); obj_sheet.SetValue(1, 9, "专用馈线"); obj_sheet.AddSpanCell(1, 10, 2, 1); obj_sheet.SetValue(1, 10, "管理体制说明"); //3行标题内容 obj_sheet.SetValue(2, 2, "公用馈线(回)"); obj_sheet.SetValue(2, 3, "电缆(千米)"); obj_sheet.SetValue(2, 4, "架空线(千米)"); 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, "(回)"); //写标题列内容 //添加数据 Sheet_AddData(obj_sheet); //设定表格线 TC.Sheet_GridandCenter(obj_sheet); //锁定表格 TC.Sheet_Locked(obj_sheet); }
/// <summary> /// 重绘 /// </summary> /// <param name="obj"></param> private void Redraw(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int BeginYear, int EndYear, string CurentYear) { obj.RowCount = 0; obj.ColumnCount = 0; obj.ColumnCount = 6; int listCount = 0; int pListCount = 0; selectDQ(FB, CurentYear); if (list != null) { listCount = list.Count; } plist = SelectedDY(FB, CurentYear); if (plist != null) { pListCount = plist.Count; } int IntRowCount = listCount + 1 + 2 + 3 + 2 + pListCount;//标题占3行,分区类型占2行,5是从序号2开始以下的行数暂定5行 obj.RowCount = IntRowCount; string strTitle = ""; IntRow = 3; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); strTitle = "附表3 截至" + CurentYear + "年底铜陵县电源统计表 "; PF.CreateSheetView(obj, IntRow, obj.ColumnCount, 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, 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, strTitle); strTitle = "项 目"; PF.CreateSheetView(obj, NextRowMerge, 4, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = " 一 "; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow += 1, IntCol -= 2, 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 = 5; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
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.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, 1, 2); obj_sheet.SetValue(1, 2, "配变低压侧补偿"); obj_sheet.AddSpanCell(1, 4, 1, 2); obj_sheet.SetValue(1, 4, "中压线路补偿"); obj_sheet.AddSpanCell(1, 6, 2, 1); obj_sheet.SetValue(1, 6, "无功补偿总容量(Mvar)"); //3行标题内容 obj_sheet.SetValue(2, 2, "配变总台数(台)"); obj_sheet.SetValue(2, 3, "无功补偿容量(Mvar)"); obj_sheet.SetValue(2, 4, "线路条数(条)"); obj_sheet.SetValue(2, 5, "无功补偿容量(Mvar)"); //写标题列内容 int startrow = 3; 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 = ""; } } } obj_sheet.SetValue(startrow + i, 1, areaname); } //写第一列数据 obj_sheet.AddSpanCell(startrow, 0, (SXareaid_List.Count + 1), 1); obj_sheet.SetValue(startrow, 0, "市辖供电区"); obj_sheet.AddSpanCell(startrow + (SXareaid_List.Count + 1), 0, (XJareaid_List.Count + 1), 1); obj_sheet.SetValue(startrow + (SXareaid_List.Count + 1), 0, "县级供电区"); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_10Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { selectLine(FB); int IntColCount = 8; int RowCount = 0; if (list != null) { RowCount = list.Count; } int IntRowCount = RowCount + 1 + 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 - 3); ++i) { switch (i) { case 0: strTitle = " 变电站 "; break; case 1: strTitle = " 线路名称 "; break; case 2: strTitle = " 电压等级 "; break; case 3: strTitle = " 线路负荷 "; break; case 4: strTitle = " 联络模式 "; break; case 5: strTitle = " 联络线路 "; break; default: break; } PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); } strTitle = "线路N-1"; PF.CreateSheetView(obj, 1, 2, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "损失负荷"; PF.CreateSheetView(obj, 1, 1, IntRow + 1, IntCol, strTitle); strTitle = "校验结果"; PF.CreateSheetView(obj, 1, 1, IntRow + 1, IntCol + 1, strTitle); NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 WriteData(FB, obj, IntRow); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_3Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int IntColCount = 6; int IntRowCount = 7 + 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, 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, strTitle); strTitle = "项 目"; PF.CreateSheetView(obj, NextRowMerge, 4, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = " 一 "; PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow += 1, IntCol -= 2, 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 = 5; IntCol = 0; //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_18Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int Temp = 0; int IntColCount = 9; int IntRowCount = 2 + 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; case 2: strTitle = " 计划开工时间 "; break; case 3: strTitle = " 计划投产时间 "; break; case 4: strTitle = " 用电量 "; break; case 5: strTitle = " 最大用电负荷 "; break; case 6: strTitle = " 所属分区 "; break; case 7: strTitle = " 备 注 "; break; default: break; } PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); } NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; SetLeftTitle(FB, obj, IntRow); //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
public void Build_Sheet(FarPoint.Win.Spread.SheetView obj_sheet) { //表格共12 行16 列 rowcount = 12; colcount = 16; //工作表第一行的标题 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 = 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.Columns[11].Width = 60; obj_sheet.Columns[12].Width = 60; obj_sheet.Columns[13].Width = 60; obj_sheet.Columns[14].Width = 60; obj_sheet.Columns[15].Width = 60; //设定表格行高度 obj_sheet.Rows[0].Height = 20; obj_sheet.Rows[1].Height = 20; obj_sheet.Rows[2].Height = 20; obj_sheet.Rows[3].Height = 20; //写标题行内容 //2行标题内容 obj_sheet.AddSpanCell(1, 0, 3, 1); obj_sheet.SetValue(1, 0, "分区"); obj_sheet.AddSpanCell(1, 1, 3, 1); obj_sheet.SetValue(1, 1, "供电区分类"); obj_sheet.AddSpanCell(1, 2, 3, 1); obj_sheet.SetValue(1, 2, "电压等级(千伏)"); obj_sheet.AddSpanCell(1, 3, 3, 1); obj_sheet.SetValue(1, 3, "线路条数"); obj_sheet.AddSpanCell(1, 4, 1, 8); obj_sheet.SetValue(1, 4, "各种接线模式的比例(%)"); obj_sheet.AddSpanCell(1, 12, 3, 1); obj_sheet.SetValue(1, 12, "环网率(%)"); obj_sheet.AddSpanCell(1, 13, 3, 1); obj_sheet.SetValue(1, 13, "网络接线标准化率(%)"); obj_sheet.AddSpanCell(1, 14, 3, 1); obj_sheet.SetValue(1, 14, "站间联络率(%)"); obj_sheet.AddSpanCell(1, 15, 3, 1); obj_sheet.SetValue(1, 15, "线路平均分段数"); //3行标题内容 obj_sheet.AddSpanCell(2, 4, 1, 6); obj_sheet.SetValue(2, 4, "典型接线"); obj_sheet.AddSpanCell(2, 10, 2, 1); obj_sheet.SetValue(2, 10, "辐射型"); obj_sheet.AddSpanCell(2, 11, 2, 1); obj_sheet.SetValue(2, 11, "其他非典型接线"); //4行标题内容 obj_sheet.SetValue(3, 4, "单环网型"); obj_sheet.SetValue(3, 5, "双环网型"); obj_sheet.SetValue(3, 6, "两供一备"); obj_sheet.SetValue(3, 7, "三供一备"); obj_sheet.SetValue(3, 8, "多分段两联络"); obj_sheet.SetValue(3, 9, "多分段三联络"); //写标题列内容 //1列标题内容 obj_sheet.AddSpanCell(4, 0, 4, 1); obj_sheet.SetValue(4, 0, "XX区(县)"); obj_sheet.AddSpanCell(8, 0, 4, 1); obj_sheet.SetValue(8, 0, "全市合计"); //2列标题内容 obj_sheet.SetValue(4, 1, "A"); obj_sheet.SetValue(5, 1, "B"); obj_sheet.SetValue(6, 1, "…"); obj_sheet.SetValue(7, 1, "小计"); obj_sheet.SetValue(8, 1, "A"); obj_sheet.SetValue(9, 1, "B"); obj_sheet.SetValue(10, 1, "…"); obj_sheet.SetValue(11, 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_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); }
/// <summary> /// 重绘 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> /// <param name="strEndYear"></param> private void ReDraw(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string strEndYear) { obj.RowCount = 0; obj.ColumnCount = 0; int IntColCount = 11; int RowCount = 0; if (list != null) { RowCount = list.Count; } int IntRowCount = RowCount + 1 + 2 + 3;//标题占3行,分区类型占2行 string title = null; obj.Columns.Count = IntColCount; obj.Rows.Count = IntRowCount; IntCol = obj.Columns.Count; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); string strTitle = "附表9 截至" + strEndYear + "年底铜陵县中压配电线路运行情况"; IntRow = 3; obj.SheetName = strTitle; 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); 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; case 2: strTitle = " 电压等级 "; break; case 3: strTitle = " 出口导线型号 "; break; case 4: strTitle = " 线路类型 "; break; case 5: strTitle = " 最大允许电流 "; break; case 6: strTitle = " 线路最大负荷 "; break; case 7: strTitle = " 线路负载率 "; break; case 8: strTitle = " 该线路所带配变总容量 "; break; case 9: strTitle = " 配变综合负载率 "; break; default: break; } PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); } NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; WriteData(FB, obj, strEndYear, IntRow); }
public void Build(FarPoint.Win.Spread.SheetView obj_sheet, int year, string ProjID, Hashtable area_key_name, Hashtable area_key_id, List <string[]> SxXjName) { //计算市辖供电区条件 string SXtiaojianareaname = " S2!='' and AreaName!='' and (" + year + "-cast(substring(S2,1,4) as int) )>=0 and AreaID='" + ProjID + "' and DQ='市辖供电区' and S4='公用' and (L1=110 or L1=66 or L1=35) group by AreaName"; string SXtiaojianareaid = " a.OperationYear!='' and a.AreaID!='' and (" + year + "-cast(a.OperationYear as int))>=0 and a.ProjectID='" + ProjID + "' and a.DQ='市辖供电区' and a.Type='06' and (b.RateVolt=110 or b.RateVolt=66 or b.RateVolt=35) group by a.AreaID"; //计算县级供电区条件 string XJtiaojianareaname = " S2!='' and AreaName!='' and (" + year + "-cast(substring(S2,1,4) as int) )>=0 and AreaID='" + ProjID + "' and DQ!='市辖供电区' and S4='公用' and (L1=110 or L1=66 or L1=35) group by AreaName"; string XJtiaojianareaid = " a.OperationYear!='' and a.AreaID!='' and (" + year + "-cast(a.OperationYear as int))>=0 and a.ProjectID='" + ProjID + "' and a.DQ!='市辖供电区' and a.Type='06' and (b.RateVolt=110 or b.RateVolt=66 or b.RateVolt=35) group by a.AreaID"; //存放市辖供电区分区名 IList <string> SXareaname = Services.BaseService.GetList <string>("SelectPSP_Substation_InfoGroupAreaName", SXtiaojianareaname); IList <string> SXareaid_List = Services.BaseService.GetList <string>("SelectPSPDEV_GroupAreaID_type06", SXtiaojianareaid); //存放县级供电区分区名 IList <string> XJareaname = Services.BaseService.GetList <string>("SelectPSP_Substation_InfoGroupAreaName", XJtiaojianareaname); IList <string> XJareaid_List = Services.BaseService.GetList <string>("SelectPSPDEV_GroupAreaID_type06", XJtiaojianareaid); //存放市辖分区名称总 List <string> SXAreaAll = new List <string>(); //存放县级分区名称总 List <string> XJAreaAll = new List <string>(); //把市辖供电区有名字的列表复制到总列表中 for (int i = 0; i < SXareaname.Count; i++) { SXAreaAll.Add(SXareaname[i]); for (int j = 0; j < SXareaid_List.Count; j++) { //通过ID查名称列表,如果重复则删除 if (SXareaname[i].ToString() == area_key_id[SXareaid_List[j]].ToString()) { SXareaid_List.Remove(SXareaid_List[j]); break; } } } //将市辖供电区中有areaid的项的剩余(上一步删除了重复的部分)部分转成areaname存到总表中 for (int j = 0; j < SXareaid_List.Count; j++) { SXAreaAll.Add(area_key_id[SXareaid_List[j]].ToString()); } //把县级供电区有名字的列表复制到总列表中 for (int i = 0; i < XJareaname.Count; i++) { XJAreaAll.Add(XJareaname[i]); for (int j = 0; j < XJareaid_List.Count; j++) { //通过ID查找名称列表,如果重复则删除 if (XJareaname[i].ToString() == area_key_id[XJareaid_List[j]].ToString()) { XJareaid_List.Remove(XJareaid_List[j]); break; } } } //将县级供电区中有areaid的项的剩余(上一步删除了重复的部分)部分转成areaname存到总表中 for (int j = 0; j < XJareaid_List.Count; j++) { XJAreaAll.Add(area_key_id[XJareaid_List[j]].ToString()); } //市辖供电区分区个数 int SXsum = SXAreaAll.Count; //县级供电区分区个数 int XJsum = XJAreaAll.Count; //表标题行数 int startrow = 3; //列标题每项行数 int length = 10; //表格共 行8 列 rowcount = startrow + (SXsum + XJsum + 2) * length; colcount = 8; //工作表第一行的标题 title = "附表8 铜陵市110kV及以下高压配电网主要设备运行年限分布(" + year + "年)"; //工作表名 sheetname = "表3-8 附表8"; //设定工作表行列值及标题和表名 fc.Sheet_RowCol_Title_Name(obj_sheet, rowcount, colcount, title, sheetname); //设定表格线 fc.Sheet_GridandCenter(obj_sheet); //设定行列模式,以便写公式使用 fc.Sheet_Referen_R1C1(obj_sheet); //设定表格列宽度 obj_sheet.Columns[0].Width = 80; obj_sheet.Columns[1].Width = 110; obj_sheet.Columns[2].Width = 90; obj_sheet.Columns[3].Width = 90; obj_sheet.Columns[4].Width = 90; obj_sheet.Columns[5].Width = 90; obj_sheet.Columns[6].Width = 90; obj_sheet.Columns[7].Width = 90; //设定表格行高度 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.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, "比例(%)"); //写入市辖供电区合计部分 Sheet_AddItem(obj_sheet, startrow, "合计"); //写入市辖供电区部分 if (SXsum > 0) { for (int i = 0; i < SXsum; i++) { //写入市辖部分列项目 Sheet_AddItem(obj_sheet, startrow + (i + 1) * length, SXAreaAll[i]); //写入市辖部分数据 string areaid = ""; if (area_key_name[SXAreaAll[i].ToString()] != null) { areaid = area_key_name[SXAreaAll[i].ToString()].ToString(); } Sheet_AddData(obj_sheet, year, ProjID, startrow + (i + 1) * length, "市辖供电区", SXAreaAll[i], areaid); } //写入市辖合计部分公式 fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + length, 4, SXsum, length, startrow, 4, 1); fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + length, 6, SXsum, length, startrow, 6, 1); } else { //没有市辖分区,直接在合计部分写0 fc.Sheet_WriteZero(obj_sheet, startrow, 4, length, 4); } //合并第一列写入市辖供电区 obj_sheet.AddSpanCell(startrow, 0, (SXsum + 1) * length, 1); obj_sheet.SetValue(startrow, 0, "市辖供电区"); //写入县级供电区合计部分 Sheet_AddItem(obj_sheet, startrow + (1 + SXsum) * length, "合计"); //写入县级供电区部分 if (XJsum > 0) { for (int i = 0; i < XJsum; i++) { //写入县级部分列项目 Sheet_AddItem(obj_sheet, startrow + (i + 2 + SXsum) * length, XJAreaAll[i]); //写入县级部分数据 string areaid = ""; if (area_key_name[XJAreaAll[i].ToString()] != null) { areaid = area_key_name[XJAreaAll[i].ToString()].ToString(); } Sheet_AddData(obj_sheet, year, ProjID, startrow + (i + 2 + SXsum) * length, "县级供电区", XJAreaAll[i], areaid); } //写入县级合计部分公式 fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + (2 + SXsum) * length, 4, XJsum, length, startrow + (1 + SXsum) * length, 4, 1); fc.Sheet_WriteFormula_RowSum(obj_sheet, startrow + (2 + SXsum) * length, 6, XJsum, length, startrow + (1 + SXsum) * length, 6, 1); } else { //没有县级分区,直接在合计部分写0 fc.Sheet_WriteZero(obj_sheet, startrow + (1 + SXsum) * length, 4, length, 4); } //合并第一列写入县级供电区 obj_sheet.AddSpanCell(startrow + (1 + SXsum) * length, 0, (XJsum + 1) * length, 1); obj_sheet.SetValue(startrow + (1 + SXsum) * length, 0, "县级供电区"); //写求比例公试 fc.Sheet_WriteFormula_TwoCol_Percent(obj_sheet, startrow, 4, (2 + SXsum + XJsum) * 2, 5, startrow, 5); fc.Sheet_WriteFormula_TwoCol_Percent(obj_sheet, startrow, 6, (2 + SXsum + XJsum) * 2, 5, startrow, 7); //锁定表格 fc.Sheet_Locked(obj_sheet); }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_20Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { SelectedPower(FB); int Temp = 0; int IntColCount = 11; int IntRowCount = list.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; for (int j = 0; j < obj.ColumnCount - BringIntoPproductionTime; ++j) { switch (j) { case 0: strTitle = "序 号"; break; case 1: strTitle = "项目名称"; break; case 2: strTitle = "类 型"; break; case 3: strTitle = "容 量"; break; case 4: strTitle = "接入电压等级"; break; } PF.CreateSheetView(obj, 2, 1, IntRow, j, strTitle); PF.SetSheetViewColumnsWidth(obj, j, strTitle); } strTitle = "投产时间"; PF.CreateSheetView(obj, 1, BringIntoPproductionTime, IntRow, 5, strTitle); for (int i = 0; i < BringIntoPproductionTime; ++i) { Temp = 2010 + i; strTitle = Temp.ToString(); PF.CreateSheetView(obj, 1, 1, IntRow + 1, 5 + i, strTitle); PF.SetSheetViewColumnsWidth(obj, 5 + i, strTitle); } NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; WriteData(obj, IntRow); //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; } }
/// <summary> /// 重绘 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> /// <param name="strEndYear"></param> private void ReDraw(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string strEndYear) { int IntColCount = 15; int RowCount = 0; if (LineList != null) { RowCount = LineList.Count; } int IntRowCount = RowCount + 1 + 2 + 3;//标题占3行,分区类型占2行 obj.RowCount = 0; obj.ColumnCount = 0; obj.Columns.Count = IntColCount; obj.Rows.Count = IntRowCount; IntCol = obj.Columns.Count; PF.Sheet_GridandCenter(obj);//画边线,居中 m_PF.LockSheets(obj); string strTitle = "附表7 截至" + strEndYear + "年底铜陵县中压线路联络情况"; IntRow = 3; obj.SheetName = strTitle; 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); 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; case 2: strTitle = " 电压等级 "; break; case 3: strTitle = " 线路类型 "; break; case 4: strTitle = " 主干线径 "; break; case 5: strTitle = " 联络线路 "; break; case 6: strTitle = " 联络线路/所属变电站 "; break; case 7: strTitle = " 联络模式 "; break; case 8: strTitle = " 开闭所 "; break; case 9: strTitle = " 环网柜 "; break; case 10: strTitle = " 分段柜 "; break; case 11: strTitle = " 联络开关 "; break; case 12: strTitle = " 分段开关 "; break; case 13: strTitle = " 支线开关 "; break; default: break; } PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); } NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; WriteData(FB, obj, strEndYear, IntRow); }
/// <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="Title"></param> public void SetSheet_16Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { const int rowStep = 4; int IntColCount = 13; int IntRowCount = 13 + 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 = " 2000 "; break; case 2: strTitle = " 2001 "; break; case 3: strTitle = " 2002 "; break; case 4: strTitle = " 2003 "; break; case 5: strTitle = " 2004 "; break; case 6: strTitle = " 2005 "; break; case 7: strTitle = " “十五”年均增长率 "; break; case 8: strTitle = " 2006 "; break; case 9: strTitle = " 2007 "; break; case 10: strTitle = " 2008 "; break; case 11: strTitle = " 2009预计 "; break; default: break; } PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); } //行标题 IntRow = 5; strTitle = "东部地区"; PF.CreateSheetView(obj, 4, 1, IntRow += 1, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "中部地区"; PF.CreateSheetView(obj, 4, 1, IntRow += 4, 0, strTitle); PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle); strTitle = "南部地区"; PF.CreateSheetView(obj, 4, 1, IntRow += 4, 0, strTitle); obj.Columns[0].Width = 100; IntRow = 6; for (int i = 0; i < 3; i++) { for (int j = 0; j < rowStep; ++j) { if (j == 0) { strTitle = "全社会用电量"; } if (j == 1) { strTitle = "网供电量"; } if (j == 2) { strTitle = "全社会最大负荷"; } if (j == 3) { strTitle = "网供最大负荷"; } PF.CreateSheetView(obj, 1, 1, (IntRow + (i * rowStep + j)), 1, strTitle); } } NextRowMerge = 1; NextColMerge = 1; IntRow = 6; IntCol = 0; WriteData(FB, obj, IntRow); //PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高 }
////////////////////////////////////////////////////////////////////////// /// <summary> /// 填写表头 /// </summary> /// <param name="obj"></param> /// <param name="Title"></param> public void SetSheet_7Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title) { int IntColCount = 15; 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; case 2: strTitle = " 电压等级 "; break; case 3: strTitle = " 线路类型 "; break; case 4: strTitle = " 主干线径 "; break; case 5: strTitle = " 联络线路 "; break; case 6: strTitle = " 联络线路/所属变电站 "; break; case 7: strTitle = " 联络模式 "; break; case 8: strTitle = " 开闭所 "; break; case 9: strTitle = " 环网柜 "; break; case 10: strTitle = " 分段柜 "; break; case 11: strTitle = " 联络开关 "; break; case 12: strTitle = " 分段开关 "; break; case 13: 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);//行高 }