本文整理汇总了C#中FarPoint类的典型用法代码示例。如果您正苦于以下问题:C# FarPoint类的具体用法?C# FarPoint怎么用?C# FarPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FarPoint类属于命名空间,在下文中一共展示了FarPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CellType
public void CellType(FarPoint.Win.Spread.SheetView obj_sheet)
{
for (int row = 2; row < 8; row++)
{
if (row!=3)
{
for (int col = 3; col < 6; col++)
{
fc.Sheet_UnLockedandCellNumber(obj_sheet, row, col);
}
for (int col = 11; col < 13; col++)
{
fc.Sheet_UnLockedandCellNumber(obj_sheet, row, col);
}
}
for (int col = 6; col < 11; col++)
{
fc.Sheet_UnLockedandCellNumber(obj_sheet, row, col);
if (col!=6)
{
obj_sheet.Cells[row, col].CellType = new FarPoint.Win.Spread.CellType.PercentCellType();
}
}
}
}
示例2: Build
public void Build(FarPoint.Win.Spread.SheetView obj_sheet,int year,string ProjID,List<string[]> SxXjName)
{
//表格共10 行8 列
rowcount = 10;
colcount = 8;
//工作表第一行的标题
title = "表3‑4 "+year+"年铜陵市并网电厂装机容量表(MW)";
//工作表名
sheetname = "表3-4";
//设定工作表行列值及标题和表名
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 = 60;
obj_sheet.Columns[1].Width = 110;
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.Rows[1].Height = 20;
obj_sheet.Rows[2].Height = 20;
//写标题行列内容
Sheet_AddItem(obj_sheet, SxXjName);
//写入数据
Sheet_AddData(obj_sheet, year, ProjID, SxXjName);
//锁定表格
fc.Sheet_Locked(obj_sheet);
}
示例3: AddData
/// <summary>
/// 加载数据同时保存数据到指定位置
/// </summary>
/// <param name="obj"></param>
private void AddData(FarPoint.Win.Spread.FpSpread obj)
{
wait = new WaitDialogForm("", "正在加载数据, 请稍候...");
try
{
//打开Excel表格
//清空工作表
fpSpread1.Sheets.Clear();
obj.OpenExcel(System.Windows.Forms.Application.StartupPath + "\\xls\\中压配电网分析.xls");
PF.SpreadRemoveEmptyCells(obj);
//this.AddCellChanged();
//this.barEditItem2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
//S4_2_1.AddBarEditItems(this.barEditItem2, this.barEditItem1, this);
}
catch (System.Exception e)
{
//如果打开出错则重新生成并保存
LoadData();
//判断文件夹是否存在,不存在则创建
if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\xls"))
{
Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\xls");
}
//保存EXcel文件
obj.SaveExcel(System.Windows.Forms.Application.StartupPath + "\\xls\\中压配电网分析.xls", FarPoint.Excel.ExcelSaveFlags.NoFlagsSet);
// 定义要使用的Excel 组件接口
// 定义Application 对象,此对象表示整个Excel 程序
Microsoft.Office.Interop.Excel.Application excelApp = null;
// 定义Workbook对象,此对象代表工作薄
Microsoft.Office.Interop.Excel.Workbook workBook;
// 定义Worksheet 对象,此对象表示Execel 中的一张工作表
Microsoft.Office.Interop.Excel.Worksheet ws = null;
Microsoft.Office.Interop.Excel.Range range = null;
excelApp = new Microsoft.Office.Interop.Excel.Application();
string filename = System.Windows.Forms.Application.StartupPath + "\\xls\\中压配电网分析.xls";
workBook = excelApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
for (int i = 1; i <= workBook.Worksheets.Count; i++)
{
ws = (Microsoft.Office.Interop.Excel.Worksheet)workBook.Worksheets[i];
//取消保护工作表
ws.Unprotect(Missing.Value);
//有数据的行数
int row = ws.UsedRange.Rows.Count;
//有数据的列数
int col = ws.UsedRange.Columns.Count;
//创建一个区域
range = ws.get_Range(ws.Cells[1, 1], ws.Cells[row, col]);
//设区域内的单元格自动换行
range.WrapText = true;
//保护工作表
ws.Protect(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
}
//保存工作簿
workBook.Save();
//关闭工作簿
excelApp.Workbooks.Close();
}
wait.Close();
}
示例4: Sheet_AddData
private void Sheet_AddData(FarPoint.Win.Spread.SheetView obj_sheet, int year, string ProjID)
{
//对于线路信息,OperationYear中存放的投产年份,Type='05'表示线路信息
//LineType2存放的公用专用标识,RateVolt存放电压,为float类型
//JXFS为接线方式,如环网、链式等
string XLtiaojian = "";
string[] JGType = { "环网", "放射型", "链式", "T型", "其它" };
string JGLX = "";
string DianYa = "";
for (int row = 2; row < 11; row++)
{
for (int col = 2; col <= 3; col++)
{
JGLX = JGType[(row / 2) - 1];
if (col == 2)
{
DianYa = "110";
}
else
{
DianYa = "35";
}
XLtiaojian = " OperationYear!='' and year(cast(OperationYear as datetime))<=" + year + " and Type='05' and LineType2='公用' and RateVolt=" + DianYa + " and ProjectID='" + ProjID + "' and JXFS='" + JGLX + "'";
int XLsum = 0;
if (Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian) != null)
{
XLsum = (int)Services.BaseService.GetObject("SelectPSPDEV_CountAll", XLtiaojian);
}
obj_sheet.SetValue(row, col, XLsum);
}
row++;
}
}
示例5: SelectEditChange
/// <summary>
/// 选中下拉菜单中的数据连接数据库表,方案
/// </summary>
/// <param name="BE"></param>
public void SelectEditChange(FarPoint.Win.Spread.FpSpread fPobj,FarPoint.Win.Spread.SheetView SheetView, object obj, Itop.Client.Base.FormBase FB)
{
//string strTitle = null;
string strID = obj.ToString();
InitTitle();
//Ps_forecast_list pfl = null;
projectID = FB.ProjectUID;
//string con1 = "Title='" + strTitle + "' and UserID='" + projectID + "'";
try
{
//查询下拉菜单所选中的数据
//pfl = (Ps_forecast_list)Services.BaseService.GetObject("SelectPs_forecast_listByWhere", con1);
//programID = pfl.ID;
programID = strID;
CityID = SelectID(strID, AreaType[0]);//市辖
CountyID = SelectID(strID, AreaType[1]);//县级
SelectDQ(CityID, AreaType[0]);
SelectDQ(CountyID, AreaType[1]);
SetLeftTitle(SheetView, 5, 0);//左侧标题
WriteData(fPobj,SheetView, 5, 0);//数据
PF.Sheet_GridandCenter(SheetView);//画边线,居中
S10_1.ColReadOnly(SheetView, SheetView.Columns.Count);
PF.SetWholeRowHeight(SheetView, SheetView.Rows.Count, SheetView.Columns.Count);//行高
}
catch (System.Exception e)
{
MessageBox.Show(e.Message);
}
}
示例6: SetYears
/// <summary>
/// 设置年分
/// </summary>
///<param name="FB">传入fromBase对象</param>
/// <param name="obj">要传入SheetView对象</param>
/// <param name="IntRow">行数</param>
/// <param name="IntCol">列数</param>
/// <param name="RowStep">要合并几个行的单元格</param>
/// <param name="ColStep">要合并几个列的单元格</param>
/// <param name="Title">标题</param>
public void SetYears(string Title, Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol, int RowStep, int ColStep)
{
GlobalFormBase = FB;
Ps_YearRange py = new Ps_YearRange();
py.Col4 = Title;
py.Col5 = FB.ProjectUID;
IList<Ps_YearRange> li = Services.BaseService.GetList<Ps_YearRange>("SelectPs_YearRangeByCol5andCol4", py);
if (li.Count > 0)
{
GlobalFirstYear = li[0].StartYear;
GlobalEndYear = li[0].FinishYear;
}
else
{
GlobalFirstYear = 2000;
GlobalEndYear = 2009;
py.BeginYear = 1990;
py.FinishYear = GlobalEndYear;
py.StartYear = GlobalFirstYear;
py.EndYear = 2060;
py.ID = Guid.NewGuid().ToString();
Services.BaseService.Create<Ps_YearRange>(py);
}
GolobalYearCount = GlobalEndYear - GlobalFirstYear + FixationCol + 1;//后面有两个固定列,加1是起始年的加入
SetYearsSheet2_1(FB, obj, GlobalFirstYear, GlobalEndYear, GolobalYearCount, IntRow, IntCol, RowStep, ColStep);
}
示例7: Build
public void Build(FarPoint.Win.Spread.SheetView obj_sheet, string ProjID, List<string[]> SxXjName)
{
//表格共9 行9 列
rowcount = 9;
colcount = 9;
//工作表第一行的标题
title = "表5‑2 铜陵市接入110kV及以下配电网的新能源电厂装机容量情况(MW)";
//工作表名
sheetname = "表5‑2";
//设定工作表行列值及标题和表名
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 = 60;
obj_sheet.Columns[1].Width = 100;
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.Columns[8].Width = 90;
//设定表格行高度
obj_sheet.Rows[1].Height = 20;
//写标题行列内容
Sheet_AddItem(obj_sheet, SxXjName);
//写入数据
Sheet_AddData(obj_sheet, ProjID, SxXjName);
//锁定表格
fc.Sheet_Locked(obj_sheet);
}
示例8: Build
public void Build(FarPoint.Win.Spread.SheetView obj_sheet,int year,string ProjID,List<string[]> SxXjName)
{
//表格共14 行4 列
rowcount = 14;
colcount = 4;
//工作表第一行的标题
title = "表3‑6 " + year + "年铜陵市高压配电网结构情况";
//工作表名
sheetname = "表3-6";
//设定工作表行列值及标题和表名
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 = 160;
obj_sheet.Columns[2].Width = 150;
obj_sheet.Columns[3].Width = 150;
//写行列标题
Sheet_AddItem(obj_sheet);
//写入数据
Sheet_AddData(obj_sheet,year,ProjID);
//写入公式
//求和公式
fc.Sheet_WriteFormula_RowSum(obj_sheet, 2, 2, 5, 2, 12, 2, 2);
//分项求比例公式
fc.Sheet_WriteFormula_Percent_Row(obj_sheet, 2, 2, 1, 3, 2, 5, 2, 12);
//总和求比例公式
fc.Sheet_WriteFormula_Percent_Row(obj_sheet, 12, 2, 0, 13, 2, 1, 2, 12);
//锁定表格
fc.Sheet_Locked(obj_sheet);
}
示例9: SetColumnsTitle
/// <summary>
/// 按照起始和结束年份写入列标题
/// </summary>
/// <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,string CurrentYear)
{
int intTemp = BeginYear;
Redraw(FB, obj, BeginYear, EndYear, CurrentYear);
WriteData(FB, obj, CurrentYear);
}
示例10: SelectEditChange
/// <summary>
/// 选中下拉菜单中的数据连接数据库表,方案
/// </summary>
/// <param name="BE"></param>
public void SelectEditChange(FarPoint.Win.Spread.FpSpread fPobj,FarPoint.Win.Spread.SheetView SheetView, object obj, Itop.Client.Base.FormBase FB)
{
string strID = null;
//strTitle = obj.EditValue.ToString();
strID=obj.ToString();
Ps_forecast_list pfl = null;
projectID = FB.ProjectUID;
string con1 = "ID='" + strID + "' and UserID='" + projectID + "'";
try
{
//查询下拉菜单所选中的数据
pfl = (Ps_forecast_list)Services.BaseService.GetObject("SelectPs_forecast_listByWhere", con1);
programID = pfl.ID;
SetLeftTitle(SheetView, 5, 0);//左侧标题
WriteData(SheetView, 5, 0);//数据
S4_3.WriteData(fPobj,fPobj.Sheets[4], 5, 0);
PF.Sheet_GridandCenter(SheetView);//画边线,居中
S10_1.ColReadOnly(SheetView, SheetView.Columns.Count);
PF.SetWholeRowHeight(SheetView, SheetView.Rows.Count, SheetView.Columns.Count);//行高
}
catch (System.Exception e)
{
//MessageBox.Show(e.Message);
}
}
示例11: ColReadOnly
/// <summary>
/// 设置某列为只读
/// </summary>
/// <param name="obj">sheetView对象</param>
/// <param name="IntCol">列数</param>
public void ColReadOnly(FarPoint.Win.Spread.SheetView obj, int IntCol)
{
for (int i = 0; i < IntCol; i++)
{
obj.Columns[i].Locked = true;//列设置为只读
}
}
示例12: SelectEditChange
/// <summary>
/// 选中下拉菜单中的数据连接数据库表,方案
/// </summary>
/// <param name="BE"></param>
public void SelectEditChange(FarPoint.Win.Spread.SheetView SheetView, object obj, Itop.Client.Base.FormBase FB)
{
string strTitle = null;
string strID = null;
strID = obj.ToString();
Ps_forecast_list pfl=null;
string con1 = "ID='" + strID + "' and UserID='" + FB.ProjectUID + "'";
try
{
//查询下拉菜单所选中的数据
pfl = (Ps_forecast_list)Services.BaseService.GetObject("SelectPs_forecast_listByWhere", con1);
strTitle = pfl.Title;
//“十二五”电网投资(千瓦时/元)
dTwelveFiveGridInvestment=TwelveFiveGridInvestment(pfl.ID, strTitle, FB);
//(2015年网供最大负荷-2010年网供最大负荷)
dNetworkMaxDuty=NetworkMaxDuty(pfl.ID, strTitle);
//2015-2010年售电收入
dSaleOfElectricity=SaleOfElectricity(pfl.ID, strTitle);
//(电网2010年末资产原值+2015年电网年末资产原值)
dInitialAssetValue=InitialAssetValue(pfl.ID, strTitle);
//单年售电量
dYearSaleEletricity=YearSaleEletricity(pfl.ID, strTitle, 2015);
WriteData(SheetView, 5, 0);//数据
}
catch(System.Exception e)
{
//MessageBox.Show(e.Message);
}
}
示例13: SetSheet_1Title
//////////////////////////////////////////////////////////////////////////
/// <summary>
/// 填写表头
/// </summary>
/// <param name="obj"></param>
/// <param name="Title"></param>
public void SetSheet_1Title(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, string Title, bool IsTrue)
{
SelectValue(FB);
int IntColCount = 5;
int IntRowCount = list.Count + 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);//画边线,居中
S10_1.ColReadOnly(obj, IntColCount);
//obj.OperationMode = FarPoint.Win.Spread.OperationMode.ReadOnly;
string strTitle = "";
IntRow = 3;
strTitle = Title;
PF.CreateSheetView(obj, IntRow, IntCol, 0, 0, Title);
PF.SetSheetViewColumnsWidth(obj, 0, Title);
IntCol = 1;
strTitle = " 变电站名称";
PF.CreateSheetView(obj, NextRowMerge += 1, NextColMerge, IntRow, IntCol -= 1, strTitle);
PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle);
strTitle = " 电压等级(kV)";
PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle);
PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle);
strTitle = " 2012年";
PF.CreateSheetView(obj, NextRowMerge, NextColMerge, IntRow, IntCol += 1, strTitle);
PF.SetSheetViewColumnsWidth(obj, IntCol, strTitle);
strTitle = " 2015年";
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;
SetLeftTitle(obj, IntRow, IntCol);
if(!IsTrue)
{
WriteData(obj, IntRow, IntCol);
}
else//更新
{
ComparisonData(obj, 5, 2);
WriteData(obj, IntRow, IntCol);
}
PF.SetWholeRowHeight(obj, obj.Rows.Count, obj.Columns.Count);//行高
}
示例14: LockSheets
/// <summary>
/// 用来全部锁住工作簿的单元格
/// </summary>
/// <param name="obj"></param>
public void LockSheets(FarPoint.Win.Spread.SheetView obj)
{
for(int j=0;j<obj.ColumnCount;++j)
{
obj.Columns[j].Locked = true;
}
}
示例15: Build
public void Build(FarPoint.Win.Spread.SheetView obj_sheet,int year,string ProjID,List<string[]> SxXjName)
{
//表格共9 行6 列
rowcount = 9;
colcount = 6;
//工作表第一行的标题
title = "表3‑5 " + year + "年铜陵市220kV或330kV电网规模";
//工作表名
sheetname = "表3-5";
//设定工作表行列值及标题和表名
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 = 60;
obj_sheet.Columns[1].Width = 110;
obj_sheet.Columns[2].Width = 80;
obj_sheet.Columns[3].Width = 80;
obj_sheet.Columns[4].Width = 80;
obj_sheet.Columns[5].Width = 80;
//添加行列标题
Sheet_AddItem(obj_sheet);
//添加数据
Sheet_AddData(obj_sheet,year,ProjID);
//写求和公式
fc.Sheet_WriteFormula_RowSum(obj_sheet, 6, 2, 2, 1, 8, 2, 4);
//锁定表格
fc.Sheet_Locked(obj_sheet);
}