/// <summary> /// 写入数据 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow) { string ID = null; //东部,中部,南部地区id string ProID = null; //项目的id号 string strRowTitleDQ = null; //地区名 string strRowTitleProject = null; //项目名称 string strColTitle = null; for (int i = IntRow; i < obj.RowCount; ++i) { strRowTitleDQ = PF.ReturnStr(obj, i, 0).ToString(); strRowTitleProject = obj.GetValue(i, 1).ToString(); ID = ReturnID(FB, strRowTitleDQ); ProID = ReturnProjectID(FB, strRowTitleProject, ID); for (int j = 2; j < obj.ColumnCount; ++j) { strColTitle = obj.GetValue(IntRow - 2, j).ToString(); if (strColTitle == " “十五”年均增长率 ") { obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j - 1) + (i + 1) + "/" + PF.GetColumnTitle(j - 6) + (i + 1) + ",1/5)-1"; obj.Cells[i, j].CellType = PC; } else { obj.SetValue(i, j, ReturnValue(FB, ProID, strColTitle)); } } } }
/// <summary> /// 返回任何行列中的字符如果有合并同类项的就向上查找 /// </summary> /// <param name="obj">SheetView</param> /// <param name="IntRow">current row</param> /// <param name="IntCol">current column</param> /// <param name="IntRowStep">当前行所在合并同类项的第几层</param> /// <param name="IntColStep">当前所在列处在合并同类项的第几层</param> /// <returns></returns> public string ReturnNext0fStr(FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol, int IntRowStep, int IntColStep) { string strReturn = null; for (int i = 0; i < IntRowStep; ++i) { for (int j = 0; j < IntColStep; ++j) { if (IntRow - i < 0 && IntCol - j < 0) { return(strReturn); } if (obj.GetValue((IntRow - i), (IntCol - j)) == null)//等于空就向上查找 { break; } else { strReturn = (string)obj.GetValue((IntRow - i), (IntCol - j)); break; } } } return(strReturn); }
/// <summary> /// 写入数据 /// </summary> /// <param name="obj"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj) { string strRowTitle = null; string strColTitle = null; for (int i = 5; 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 == "人均GDP") { } 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 { if (strRowTitle == " 第一产业比重" || strRowTitle == "第二产业比重" || strRowTitle == "第三产业比重") { obj.Cells[i, j].CellType = PC;//% } obj.SetValue(i, j, SelectCurrentData(FB, strColTitle, strRowTitle)); } } } } //向人均GDP那行回写数据 for (int j = 1; j < obj.ColumnCount; ++j) { strColTitle = obj.GetValue(4, j).ToString(); if (strColTitle == "“十五”年均增速" || strColTitle == "“十一五”年均增速" || strColTitle == "“十二五”年均增速" || strColTitle == "“十三五”年均增速") { obj.Cells[7, j].Formula = "POWER(" + PF.GetColumnTitle(j - 5) + (8) + "/" + PF.GetColumnTitle(j - 1) + 8 + ",1/5)-1"; obj.Cells[7, j].CellType = PC;//% } else { obj.Cells[7, j].Formula = PF.GetColumnTitle(j) + (7) + "/" + PF.GetColumnTitle(j) + (12); } } }
public void SaveData(FarPoint.Win.Spread.SheetView obj_sheet) { //清空存放数据列表 SDL317.Clear(); //市辖部分的行号 int SXrow = fc.Sheet_Find_Value(obj_sheet, 0, "1"); //县级部分的行号 int XJrow = fc.Sheet_Find_Value(obj_sheet, 0, "2"); //差为电压等级数 int DYnum = XJrow - SXrow; //存在电压等级 if (DYnum != 0) { //市辖供电区加上县级供电区的四个分区,共有5个分区,加上县级合计有6个分区 for (int row = SXrow; row < obj_sheet.RowCount - DYnum; row++) { savedata tempdata = new savedata(); //县级合计部分跳过 if (row == XJrow) { row = row + DYnum; } string no = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 0); string dy = obj_sheet.Cells[row, 2].Value.ToString(); tempdata.no = no; tempdata.dy = dy; tempdata.data = obj_sheet.GetValue(row, 6); SDL317.Add(tempdata); } } }
/// <summary> /// 计算城镇化率 /// </summary> /// <param name="obj">SheetView Object</param> /// <param name="Years">current year</param> /// <param name="IntRow">current row</param> /// <param name="IntCol">current column</param> private void AccountUrbanizationRate(FarPoint.Win.Spread.SheetView obj, int Years, int IntRow, int IntCol) { float Temp = 0; string Temp1 = "y" + Years.ToString(); Temp = (float)PF.Gethistroyvalue <Ps_History>(resualt["城镇人口(万人)"], Temp1); obj.SetValue(IntRow, IntCol, PF.ReturnFormatStr(Temp / StrToFloat(obj.GetValue((IntRow), IntCol - 4).ToString()))); }
public void SaveData(FarPoint.Win.Spread.SheetView obj_sheet) { //清空存放数据列表 SDL318_19.Clear(); //市辖部分的行号 int SXrow = fc.Sheet_Find_Value(obj_sheet, 0, "市辖供电区"); //县级部分的行号 int XJrow = fc.Sheet_Find_Value(obj_sheet, 0, "县级供电区"); //为-1时表示没找到,也就是电压等级为0个 if (SXrow != -1) { //市辖供电区中第一行第二列的“合计”部分合并的行数就是电压等级数 //int dysum = obj_sheet.Cells[SXrow, 1].RowSpan; int dysum = 1; //存储市辖部分除合计以外的数据 for (int row = SXrow + dysum; row < XJrow; row++) { savedata tempdata = new savedata(); tempdata.DQ = "市辖供电区"; tempdata.areaname = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1); for (int col = 2; col < 6; col++) { tempdata.data[col - 2] = obj_sheet.GetValue(row, col); } SDL318_19.Add(tempdata); } //存储县级部分除合计以外的数据 for (int row = XJrow + dysum; row < obj_sheet.RowCount; row++) { savedata tempdata = new savedata(); tempdata.DQ = "县级供电区"; tempdata.areaname = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1); for (int col = 2; col < 6; col++) { tempdata.data[col - 2] = obj_sheet.GetValue(row, col); } SDL318_19.Add(tempdata); } } }
/// <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 SaveData(FarPoint.Win.Spread.SheetView obj_sheet) { SDL33_1.Clear(); //返回县级供电区开始行号 int xjrow = fc.Sheet_Find_Value(obj_sheet, 0, "县级供电区"); for (int row = 3; row < obj_sheet.RowCount; row++) { if (row != xjrow) { savedata tempdata = new savedata(); tempdata.DQ = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 0); tempdata.areaname = obj_sheet.Cells[row, 1].Value.ToString(); tempdata.data[0] = obj_sheet.GetValue(row, 2); tempdata.data[1] = obj_sheet.GetValue(row, 3); tempdata.data[2] = obj_sheet.GetValue(row, 4); tempdata.data[3] = obj_sheet.GetValue(row, 5); tempdata.data[4] = obj_sheet.GetValue(row, 6); SDL33_1.Add(tempdata); } } }
public void SaveData(FarPoint.Win.Spread.SheetView obj_sheet) { //清空存放数据列表 SDL317_17.Clear(); //市辖部分的行号 int SXrow = fc.Sheet_Find_Value(obj_sheet, 0, "市辖供电区"); //县级部分的行号 int XJrow = fc.Sheet_Find_Value(obj_sheet, 0, "县级供电区"); //为-1时表示没找到,也就是电压等级为0个 if (SXrow != -1) { //市辖供电区中第一行第二列的“合计”部分合并的行数就是电压等级数 int dysum = obj_sheet.Cells[SXrow, 1].RowSpan; //存储市辖部分除合计以外的所有行的第7列数据 for (int row = SXrow + dysum; row < XJrow; row++) { savedata tempdata = new savedata(); tempdata.DQ = "市辖供电区"; tempdata.areaname = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1); tempdata.dy = obj_sheet.Cells[row, 2].Value.ToString(); tempdata.data = obj_sheet.GetValue(row, 6); SDL317_17.Add(tempdata); } //存储县级部分除合计以外的所有行的第7列数据 for (int row = XJrow + dysum; row < obj_sheet.RowCount; row++) { savedata tempdata = new savedata(); tempdata.DQ = "县级供电区"; tempdata.areaname = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1); tempdata.dy = obj_sheet.Cells[row, 2].Value.ToString(); tempdata.data = obj_sheet.GetValue(row, 6); SDL317_17.Add(tempdata); } } }
/// <summary> /// 通过传入的内容返回内容所在行的值 /// </summary> /// <param name="strObj"></param> /// <param name="IntRow">current row</param> /// <param name="IntCol">要查询内容的列值</param> /// <param name="YearCount">年份的数量</param> /// <returns></returns> public int ReturnRow(FarPoint.Win.Spread.SheetView obj, string strObj, int IntRow, int IntCol) { string strTemp = null; strTemp = obj.GetValue(IntRow, IntCol).ToString(); if (strTemp == strObj) { return(IntRow); } else { return(ReturnRow(obj, strObj, IntRow -= 1, IntCol)); } }
/// <summary> /// “十五”年均增长率 /// </summary> private void FifteenYears(FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol) { string strFirstYear = ""; string strNextYear = ""; double Pitch = 0; strFirstYear = obj.GetValue(5, 0).ToString(); strNextYear = obj.GetValue(6, 0).ToString(); Pitch = (double)PF.YearsPitch(strFirstYear, strNextYear); Pitch = (double)(1 / Pitch); //年末总人口(万人) SetCellType(obj, PC, (IntRow), IntCol + 4); obj.Cells[IntRow, IntCol + 4].Formula = "POWER(((E" + (7) + ")/E" + (6) + "), " + Pitch + ")-1"; //人均GDP(万元/人) SetCellType(obj, PC, (IntRow), IntCol + 5); obj.Cells[IntRow, IntCol + 5].Formula = "POWER(((F" + (7) + ")/F" + (6) + "), " + Pitch + ")-1"; //城镇人口(万人) SetCellType(obj, PC, (IntRow), IntCol + 6); obj.Cells[IntRow, IntCol + 6].Formula = "POWER(((G" + (7) + ")/G" + (6) + "), " + Pitch + ")-1"; //乡村人口(万人) SetCellType(obj, PC, (IntRow), IntCol + 7); obj.Cells[IntRow, IntCol + 7].Formula = "POWER(((H" + (7) + ")/H" + (6) + "), " + Pitch + ")-1"; }
public void SaveData(FarPoint.Win.Spread.SheetView obj_sheet) { save91_52list.Clear(); int startrow = 3 + 8; int xjrow = fc.Sheet_Find_Value(obj_sheet, 0, "县级供电区"); for (int row = startrow; row < xjrow; row++) { SaveData9152 tempdata = new SaveData9152(); tempdata.DQ = "市辖供电区"; tempdata.AreaName = obj_sheet.Cells[row, 1].Value.ToString(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 12; j++) { tempdata.data[i, j] = obj_sheet.GetValue(row + i, 5 + j); } } save91_52list.Add(tempdata); row = row + 7; } for (int row = xjrow + 8; row < obj_sheet.RowCount; row++) { SaveData9152 tempdata = new SaveData9152(); tempdata.DQ = "县级供电区"; tempdata.AreaName = obj_sheet.Cells[row, 1].Value.ToString(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 12; j++) { tempdata.data[i, j] = obj_sheet.GetValue(row + i, 5 + j); } } save91_52list.Add(tempdata); row = row + 7; } }
/// <summary> /// 人均GDP /// </summary> /// <param name="obj">SheetView object</param> /// <param name="Title">title</param> /// <param name="Years">current year</param> /// <param name="IntRow">current row</param> /// <param name="IntCol">current column</param> private void PerCapitaGDP(FarPoint.Win.Spread.SheetView obj, Itop.Client.Base.FormBase FB, string Title, int Years, int IntRow, int IntCol) { float Temp = 0; string Temp1 = "y" + Years.ToString(); Ps_History GDP1 = null; string con = null; con = "Title='" + "全地区GDP(亿元)" + "'AND Col4='" + FB.ProjectUID + "'AND Forecast='" + IntType + "'"; GDP1 = (Ps_History)Services.BaseService.GetObject("SelectPs_HistoryByCondition", con); resualt.Add("全地区GDP(亿元)", GDP1); Temp = (float)PF.Gethistroyvalue <Ps_History>(resualt["全地区GDP(亿元)"], Temp1); obj.SetValue(IntRow, IntCol, Temp / StrToFloat(obj.GetValue((IntRow), IntCol - 1).ToString())); //PF.SetRowHight(obj,IntRow, IntCol, Temp / StrToFloat(obj.GetValue((IntRow), IntCol - 1).ToString())); }
/// <summary> /// 写入数据 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> /// <param name="strEndYear"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string strEndYear, int IntRow) { string strRowTitle = ""; string strColTitle = ""; for (int i = IntRow; i < RowBDZList.Count + IntRow; ++i) { strRowTitle = (string)PF.ReturnStr(obj, i, 0); for (int j = 1; j < obj.ColumnCount; ++j) { //obj.Cells[i, j].Locked = false; strColTitle = obj.GetValue((IntRow - 2), j).ToString(); obj.SetValue(i, j, selectCount(FB, strEndYear, strRowTitle, strColTitle)); } } }
/// <summary> /// 通过标题查找当前标题在哪行 /// </summary> /// <param name="Title">标题</param> /// <param name="obj">sheetView对象</param> /// <param name="IntRow">起始行</param> /// <param name="IntCol">起始列</param> /// <returns>行数</returns> private int YearRow1(FarPoint.Win.Spread.SheetView obj, string Title, int IntRow, int IntCol) { int floor = GolobalYearCount - GolobalYears; int TempRow = 0; string strTemp = null; for (int i = 1; i < floor; i++) { strTemp = obj.GetValue(IntRow + i - 1, IntCol).ToString(); if (strTemp == Title) { TempRow = IntRow + i;//行数从0开始所以不用-1 break; } } return(TempRow); }
/// <summary> /// 写入数据 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> /// <param name="IntRow"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow) { string strRowTitle = ""; string strColTitle = ""; for (int i = IntRow; i < obj.RowCount; ++i) { strRowTitle = (string)PF.ReturnStr(obj, i, 1); for (int j = 2; j < obj.ColumnCount; ++j) { strColTitle = (string)obj.GetValue(IntRow - 2, j); if (strColTitle == "“十二五”年均增长率") { obj.Cells[i, j].Formula = "POWER(" + PF.GetColumnTitle(j - 1) + (i + 1) + "/" + PF.GetColumnTitle(j - 6) + (i + 1) + ",1/5)-1"; obj.Cells[i, j].CellType = PC; } else { obj.SetValue(i, j, ReturnValue(strRowTitle, strColTitle, programID)); } } } }
/// <summary> /// 写入数据 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow) { string strRowTitle = null; string strColTitle = null; for (int i = IntRow; i < obj.RowCount; ++i) { strRowTitle = PF.ReturnStr(obj, (i), 1).ToString(); for (int j = 2; j < obj.ColumnCount; ++j) { strColTitle = obj.GetValue((4), j).ToString(); 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 { if (strRowTitle != " 网供最大负荷利用小时 ") { obj.SetValue(i, j, SelectCurrentData(FB, strColTitle, strRowTitle)); } else { obj.Cells[i, j].Formula = PF.GetColumnTitle(j) + (i - 2) + "/" + PF.GetColumnTitle(j) + (i); } } } } }
public void SaveData(FarPoint.Win.Spread.SheetView obj_sheet) { SDL3_7_3.Clear(); //用于更新时保存用户数据 for (int row = 5; row < obj_sheet.Rows.Count; row++) { if (obj_sheet.Cells[row, 1].Value.ToString() != "合计") { savedata tempsd = new savedata(2, 3); tempsd.DQ = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 0); tempsd.AreaName = fc.Sheet_find_Rownotemptycell(obj_sheet, row, 1); if (obj_sheet.Cells[row, 4].Value != null) { tempsd.data[0, 0] = obj_sheet.GetValue(row, 4); } if (obj_sheet.Cells[row, 7].Value != null) { tempsd.data[0, 1] = obj_sheet.GetValue(row, 7); } if (obj_sheet.Cells[row, 14].Value != null) { tempsd.data[0, 2] = obj_sheet.GetValue(row, 14); } if (obj_sheet.Cells[row + 1, 4].Value != null) { tempsd.data[1, 0] = obj_sheet.GetValue(row + 1, 4); } if (obj_sheet.Cells[row + 1, 7].Value != null) { tempsd.data[1, 1] = obj_sheet.GetValue(row + 1, 7); } if (obj_sheet.Cells[row + 1, 14].Value != null) { tempsd.data[1, 2] = obj_sheet.GetValue(row + 1, 14); } SDL3_7_3.Add(tempsd); } //行号加一 row++; } }
/// <summary> /// get date /// </summary> /// <param name="obj">SheetView object</param> /// <param name="FB">FormBase object</param> /// <param name="BE">barEditItem object</param> public void ConnectionDate(FarPoint.Win.Spread.SheetView obj, Itop.Client.Base.FormBase FB) { string year = "y2010"; string title = null; double Temp = 0.0; double Temp1 = 0.0; int IntRow = 6; //MessageBox.Show(year+"年"); try { //计算一产,二产,三产之和++++++++++++++++++++++++++++++++++++++++ ReturnRecordSet(FB, year, T.T4); ReturnRecordSet(FB, year, T.T5); ReturnRecordSet(FB, year, T.T6); SumThree(year, T.T4); SumThree(year, T.T5); SumThree(year, T.T6); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //计算年末总人口(万人) title = T.T7;//城镇人口 ReturnRecordSet(FB, year, title); Temp = PF.Gethistroyvalue <Ps_History>(resualt[title], year); title = T.T8;//乡村人口 ReturnRecordSet(FB, year, title); Temp1 = PF.Gethistroyvalue <Ps_History>(resualt[title], year); //地市名称 title = T.T9; WriteValue(obj, IntRow, 0, title, 0.00); for (int i = 1; i <= 3; i++)//人口,GDP,人均GDP { //2010年(万人) title = T.T1; ReturnRecordSet(FB, year, title); if (i == 1) { WriteValue(obj, IntRow, 1, title, PF.ReturnFormatStr(Temp + Temp1)); } if (i == 2) { WriteValue(obj, IntRow, 4, title, PF.ReturnFormatStr(floatSum[3])); } if (i == 3) { obj.Cells[IntRow, 7].Formula = "E" + (IntRow + 1) + "/B" + (IntRow + 1); } //2015年(万人)手写 title = T.T2; //obj.SetValue(IntRow,2,225.13); //obj.SetValue(IntRow, 5, 225.13); //obj.SetValue(IntRow, 8, 225.13); //年均增长率(%) title = T.T3; if (i == 1) { if (obj.GetValue(IntRow, 2) == null) { obj.SetValue(IntRow, 3, 0); } obj.Cells[IntRow, 3].Formula = "POWER(((C" + (IntRow + 1) + ")/(B" + (IntRow + 1) + ")), 0.2) - 1"; //PF.SetRowHight(obj, IntRow, 3, obj.GetValue(IntRow, 3).ToString()); } if (i == 2) { if (obj.GetValue(IntRow, 5) == null) { obj.SetValue(IntRow, 5, 0); } obj.Cells[IntRow, 3 * i].Formula = "POWER(F" + (IntRow + 1) + "/E" + (IntRow + 1) + ", 0.2) - 1"; //PF.SetRowHight(obj, IntRow, 3 * i, obj.GetValue(IntRow, 3 * i).ToString()); } if (i == 3) { if (obj.GetValue(IntRow, 8) == null) { obj.SetValue(IntRow, 8, 0); } obj.Cells[IntRow, 3 * i].Formula = "POWER(I" + (IntRow + 1) + "/H" + (IntRow + 1) + ", 0.2) - 1"; //PF.SetRowHight(obj, IntRow, 3 * i, obj.GetValue(IntRow, 3 * i).ToString()); } } } catch (System.Exception e) { MessageBox.Show(e.Message); //MessageBox.Show("数据库没有标题为:" + title + "年份是:" + year + "年的数据"); } }
/// <summary> /// get date /// </summary> /// <param name="obj">SheetView object</param> /// <param name="FB">FormBase object</param> /// <param name="BE">barEditItem object</param> public void ConnectionDate(FarPoint.Win.Spread.SheetView obj, Itop.Client.Base.FormBase FB, DevExpress.XtraBars.BarEditItem BE) { string year = "y" + BE.EditValue.ToString(); string title = null; double Temp = 0.0; double Temp1 = 0.0; string strTemp = null; //MessageBox.Show(year+"年"); try { //地市名称 title = T.T9; WriteValue(obj, 5, 0, title, 0.00); //土地面积(km2) title = T.T1; ReturnRecordSet(FB, year, title); WriteValue(obj, 5, 1, title, PF.Gethistroyvalue <Ps_History>(resualt[title], year)); //建成区面积(km2) title = T.T2; ReturnRecordSet(FB, year, title); WriteValue(obj, 5, 2, title, PF.Gethistroyvalue <Ps_History>(resualt[title], year)); //GDP(亿元) title = T.T3; ReturnRecordSet(FB, year, title); WriteValue(obj, 5, 3, title, PF.ReturnFormatStr(PF.Gethistroyvalue <Ps_History>(resualt[title], year))); //计算一产,二产,三产之和++++++++++++++++++++++++++++++++++++++++ title = T.T4; ReturnRecordSet(FB, year, title); floatSum[0] = (float)PF.Gethistroyvalue <Ps_History>(resualt[title], year); title = T.T5; ReturnRecordSet(FB, year, title); floatSum[1] = (float)PF.Gethistroyvalue <Ps_History>(resualt[title], year); title = T.T6; ReturnRecordSet(FB, year, title); floatSum[2] = (float)PF.Gethistroyvalue <Ps_History>(resualt[title], year); floatSum[3] = floatSum[0] + floatSum[1] + floatSum[2]; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //一产 WriteValue(obj, 5, 4, title, floatSum[0] / floatSum[3]); //PF.SetRowHight(obj, 5, 4, floatSum[0]/floatSum[3]); //二产 title = T.T5; WriteValue(obj, 5, 5, title, floatSum[1] / floatSum[3]); //PF.SetRowHight(obj, 5, 5, floatSum[0]/floatSum[3]); //三产 title = T.T6; WriteValue(obj, 5, 6, title, floatSum[2] / floatSum[3]); //PF.SetRowHight(obj, 5, 6, floatSum[0]/floatSum[3]); //年末总人口(万人) title = T.T7;//城镇人口 ReturnRecordSet(FB, year, title); Temp = PF.Gethistroyvalue <Ps_History>(resualt[title], year); title = T.T8;//乡村人口 ReturnRecordSet(FB, year, title); Temp1 = PF.Gethistroyvalue <Ps_History>(resualt[title], year); title = "年末总人口(万人)"; WriteValue(obj, 5, 7, title, PF.ReturnFormatStr(Temp + Temp1)); //人均GDP(万元/人) floatSum[4] = S2_N.StrToFloat(obj.GetValue(5, 3).ToString()); floatSum[5] = S2_N.StrToFloat(obj.GetValue(5, 7).ToString()); WriteValue(obj, 5, 8, title, (floatSum[4] / floatSum[5])); //PF.SetRowHight(obj, 5, 8, (floatSum[4] / floatSum[5])); //城镇化率(%) floatSum[6] = S2_N.StrToFloat(obj.GetValue(5, 7).ToString()); WriteValue(obj, 5, 9, title, PF.ReturnFormatStr(Temp / floatSum[6])); } catch (System.Exception e) { //MessageBox.Show("数据库没有标题为:"+title+"年份是:"+year+"年的数据"); } }
/// <summary> /// 写入数据 /// </summary> /// <param name="FB"></param> /// <param name="obj"></param> private void WriteData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow) { string strRowTitle = null; string strColTitle = null; Ps_History ps1 = null; //全社会用电总计 Ps_History ps2 = null; //全行业用电合计 Ps_History ps3 = null; //全行业用电分类 ps1 = ReturnStrID(FB, "全社会用电量(亿kWh)"); //全社会用电总计 ps2 = ReturnStrID(FB, "全行业用电合计"); //全行业用电合计 ps3 = ReturnStrID(FB, "全行业用电分类"); //全行业用电分类 for (int i = IntRow; i < obj.RowCount; ++i) { strRowTitle = PF.ReturnStr(obj, (i), 1).ToString(); for (int j = 2; j < obj.ColumnCount; ++j) { strColTitle = obj.GetValue((4), j).ToString(); if (strColTitle == "“十五”年均增长率" || strColTitle == "“十一五”年均增长率" || strColTitle == "“十二五”年均增长率" || strColTitle == "“十三五”年均增长率") { if (strColTitle == "“十五”年均增长率") { if (strRowTitle != "所占百分比(%)") { 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 { if (strRowTitle == "所占百分比(%)") { obj.Cells[i, j].Formula = PF.GetColumnTitle(j) + (i) + "/" + PF.GetColumnTitle(j) + (8); obj.Cells[i, j].CellType = PC;//% } else if (strRowTitle == "合计") { obj.Cells[i, j].Formula = "SUM(" + PF.GetColumnTitle(j) + (14) + "," + PF.GetColumnTitle(j) + (16) + "," + PF.GetColumnTitle(j) + (18) + "," + PF.GetColumnTitle(j) + (20) + "," + PF.GetColumnTitle(j) + (22) + "," + PF.GetColumnTitle(j) + (24) + "," + PF.GetColumnTitle(j) + (26) + "," + PF.GetColumnTitle(j) + (28) + ")"; } else if (strRowTitle == "公共事业及管理组织") { obj.Cells[i, j].Formula = PF.GetColumnTitle(j) + (8) + "-" + PF.GetColumnTitle(j) + (14) + "-" + PF.GetColumnTitle(j) + (16) + "-" + PF.GetColumnTitle(j) + (18) + "-" + PF.GetColumnTitle(j) + (20) + "-" + PF.GetColumnTitle(j) + (22) + "-" + PF.GetColumnTitle(j) + (24) + "-" + PF.GetColumnTitle(j) + (26); } else { obj.SetValue(i, j, SelectCurrentData(FB, strColTitle, strRowTitle, ps1, ps2, ps3)); } } } } }