Fpspread1控件使用手册.docx
- 文档编号:9326233
- 上传时间:2023-02-04
- 格式:DOCX
- 页数:15
- 大小:20.98KB
Fpspread1控件使用手册.docx
《Fpspread1控件使用手册.docx》由会员分享,可在线阅读,更多相关《Fpspread1控件使用手册.docx(15页珍藏版)》请在冰豆网上搜索。
Fpspread1控件使用手册
Fpspread1控件使用手册:
数据类型的使用:
Setting
Description
Constant
0-Date
Createsdatecell
CellTypeDate
1-Edit
(Default)Createseditcell
CellTypeEdit
4-PIC
CreatesPICcell
CellTypePic
5-StaticText
Createsstatictextcell
CellTypeStaticText
6-Time
Createstimecell
CellTypeTime
7-Button
Createsbuttoncell
CellTypeButton
8-ComboBox
Createscomboboxcell
CellTypeComboBox
9-Picture
Createspicturecell
CellTypePicture
10-CheckBox
Createscheckboxcell
CellTypeCheckBox
11-Owner-Drawn
Createsowner-drawncell
CellTypeOwnerDrawn
12-Currency
Createscurrencycell
CellTypeCurrency
13-Number
Createsnumericcell
CellTypeNumber
14-Percent
Createspercentcell
CellTypePercent
15-Scientific
Createsscientificcell
CellTypeScientific
一、日期型的使用
ShortDaysUs="星期一"+s+"MO"+s+"TU"+s+"WE"+s+"TH"+s+"FR"+s+"SA"
LongDaysUs="星期一"+s+"MON"+s+"TUE"+s+"WED"+s+"THU"+s+"FRI"+s+"SAT"
ShortMonthsUs="一月"+s+"FEB"+s+"MAR"+s+"APR"+s+"MAY"+s+"JUN"+s+"JUL"+s+"AUG"+s+"SEP"+s+"OCT"+s+"NOV"+s+"DEC"
LongMonthsUs="一月"+s+"FEBR"+s+"MARC"+s+"APRI"+s+"MAY"+s+"JUNE"+s+"JULY"+s+"AUGU"+s+"SEPT"+s+"OCTO"+s+"NOVE"+s+"DECE"
Fpspread1.col=1
fpspread1.Value=date
fpspread1.CellType=CellTypeDate
Callfpspread1.SetCalText(ShortDaysUs,LongDaysUs,ShortMonthsUs,LongMonthsUs,"Accept","Deny")
二、下拉框的使用
fpSpread1.Row=2
fpSpread1.Col=2
fpSpread1.CellType=CellTypeComboBox
fpSpread1.TypeComboBoxList="Mastiff"+Chr$(9)+"Sheepdog"+Chr$(9)+"Terrier"+Chr$(9)+"Spaniel"+Chr$(9)+"Pointer"+Chr$(9)+"Coonhound"
fpSpread1.TypeComboBoxString="Dogwood"
fpSpread1.TypeComboBoxString="Pear"
fpSpread1.TypeComboBoxEditable=True
fpSpread1.TypeComboBoxMaxDrop=5
fpSpread1.TypeComboBoxCurSel=0
fpSpread1.TypeComboBoxWidth=0
三、换行
fpSpread1.TypeEditMultiLine=True
fpSpread1.Text="Hollygrowsassmallbushesandaslargetrees."
cellheight=fpSpread1.MaxTextCellHeight
fpSpread1.RowHeight(3)=cellheight
四、当前单元格的数据:
PrivateSubCommand1_Click()
fpSpread1.Row=fpSpread1.ActiveRow
fpSpread1.Col=fpSpread1.ActiveCol
Text1.Text=fpSpread1.Text
EndSub
五、不能调整每一列大小
fpSpread1.UserResize=SS_USER_RESIZE_NONE
fpSpread1.SetActiveCell4,3‘得到光标
六、这个函数的主要作用是指定范围的单元格是否可编辑。
fpSpread1.EditModePermanent=True
SubLockCells(ColAsLong,col2AsLong,RowAsLong,row2AsLong,celllockAsBoolean)
fpSpread1.Col=Col
fpSpread1.col2=col2
fpSpread1.Row=Row
fpSpread1.row2=row2
fpSpread1.BlockMode=True
fpSpread1.Lock=celllock
fpSpread1.BlockMode=False
EndSub
七、控制网络线
fpSpread1.GridShowHoriz=False‘列线
fpSpread1.GridShowVert=False‘行线
fpSpread1.GridSolid=True
fpSpread1.GridColor=RGB(0,0,0)
八、公式的设置
fpSpread1.Col=4
fpSpread1.Row=7
fpSpread1.Formula="d3+d5"
fpSpread1.Formula="d3*g3"
1, 在调用的.aspx页面开头注册:
"FarPoint.Web.Spread" Assembly="FarPoint.Web.SpreadJ, Version=2.0.1.0, Culture=neutral, PublicKeyToken=a5fa960294d899e7" %>
2,将控件加入到.aspx页面中:
fpspread id="FpSpread1" style="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 104px" runat="server" width="448px" height="223px"> sheetview sheetname="Sheet1"> sheetview>
fpspread>
3,页面对应的cs文件中加入对应的方法:
a, 向表中加入数据
//声明数据类对象
FarPoint.Web.Spread.Model.ISheetDataModel model;
//new一个M行N列的添充数据对象
model = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(M, N);
//向i行j列的添充数据
model.SetValue(i, j, “String”);
//向i列的表头添加名称
FpSpread1.ActiveSheetView.ColumnHeader.Cells[0, i].Text = "数字";
//鼠标双击任意列的表头就可对那一列为关键值排序
FpSpread1.ActiveSheetView.AllowSort = true;
FpSpread1.ActiveSheetView.SetColumnSortIndicator(0, FarPoint.Web.Spread.Model.SortIndicator.Descending);
//表中向i行j列加入ComboBox列并能读取数据和选择功能。
FarPoint.Web.Spread.ComboBoxCellType cb=new FarPoint.Web.Spread.ComboBoxCellType(new string[] {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"}, new string[] {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"});
cb.ShowButton=true;
FpSpread1.Sheets[0].Cells[4, 2].CellType = cb;
//表中向k行第一列加入CheckBox列
FarPoint.Web.Spread.CheckBoxCellType ckb = new FarPoint.Web.Spread.CheckBoxCellType("Select", "Selected");
FpSpread1.Sheets[0].Cells[k, 0].CellType = ckb;
// 在spread的第一个Sheets中i行j列的取得数据对象
FpSpread1.Sheets[0].Cells[i, j].Text;
4,要在spread中显示各种控制图标:
在spreadsort目录下有个目录fp_client设置为IIS的虚拟目录就可以了!
设置行数列数
FpSpread1.ActiveSheetView.ColumnCount=3;
FpSpread1.ActiveSheetView.RowCount=11;
分页
FpSpread1.ActiveSheetView.AllowPage=false;
列宽
FpSpread1.ActiveSheetView.Columns[0].Width=160;
FpSpread1.ActiveSheetView.Columns[1].Width=200;
FpSpread1.ActiveSheetView.Columns[2].Width=(int)(FpSpread1.Width.Value-360- FpSpread1.RowHeader.Width-2);
指定单元格的读取和赋值
FpSpread1.ActiveSheetView.Cells[0,1].Text="CustomCellEditor/Renderer";
FpSpread1.ActiveSheetView.Cells[0,2].Text="ValuesfromeditorareRGBofBackColor";
指定控件区域大小
FpSpread1.Height=Unit.Pixel(300);
FpSpread1.Width=Unit.Pixel(763);
设置列的类型
FarPoint.Web.Spread.CheckBoxCellTypeobjIntCell=newFarPoint.Web.Spread.CheckBoxCellType();
FpSpread1.Sheets[0].Columns[0].CellType=objIntCell;
定义边框部分
FpSpread1.BorderColor=Color.Green;
FpSpread1.BorderStyle=BorderStyle.Dashed;
FpSpread1.BorderWidth=System.Web.UI.WebControls.Unit.Pixel(4);
添加一个新的工作表
FarPoint.Web.Spread.SheetViewnewsheet=newFarPoint.Web.Spread.SheetView();
newsheet.SheetName="North";
newsheet.ColumnCount=10;
newsheet.RowCount=100;
然后把刚才的工作表加到控件中
FpSpread1.Sheets.Add(newsheet);
移除一个工作表
FpSpread1.Sheets.Remove(FpSpread1.Sheets[1]);
指定一个工作表是否显示
FpSpread1.Sheets[1].Visible=false;
为指定的工作表设置背景
FpSpread1.Sheets[0].BackColor=Color.LightYellow;
设置页大小陈列15行(不明白)
FpSpread1.ActiveSheetView.PageSize=15;
指定网格线的样式
FpSpread1.Sheets[0].GridLineColor=Color.Red;
FpSpread1.Sheets[0].GridLines=GridLines.Horizontal;
定制工作表的角落(不明白)
FpSpread1.Sheets[0].SheetCornerStyle.BorderColor=Color.Green;
FpSpread1.Sheets[0].SheetCornerStyle.BorderStyle=BorderStyle.Dashed;
FpSpread1.Sheets[0].SheetCornerStyle.BorderWidth=4;
为工作表指定使用哪个皮肤
FarPoint.Web.Spread.DefaultSkins.Colorful2.Apply(FpSpread1.Sheets[0]);
自定义皮肤,并赋予工作表
FarPoint.Web.Spread.SheetSkinmyskin=newFarPoint.Web.Spread.SheetSkin("MySkin",Color.BlanchedAlmond,Color.Bisque,Color.Navy,2,Color.Blue,GridLines.Both,Color.Beige,Color.BurlyWood,Color.AntiqueWhite,Color.Brown,Color.Bisque,Color.Bisque,true,true,true,true,false);
myskin.Apply(FpSpread1.Sheets[1]);
增加行列数
FpSpread1.Sheets[0].AddColumns(6,2);
移除行列
FpSpread1.Sheets[0].RemoveRows(6,2);
设置工作表中指定行列显示或者隐藏
FpSpread1.Sheets[0].SetRowVisible(1,false);
FpSpread1.Sheets[0].SetColumnVisible(2,false);
设置工作表默认行高列宽,以及单独指定行号列宽
FpSpread1.Sheets[0].DefaultColumnWidth=50;
FpSpread1.Sheets[0].Columns[1].Width=100;
设置TopRow
SheetView.TopRow=4;
创建多个不同的行模板
以下是设置行模板为3,第一行是默认样式然后为第二三行赋予新的样式下面的行将重复此样式FpSpread1.Sheets[0].AlternatingRows.Count=3;
FpSpread1.Sheets[0].AlternatingRows[1].BackColor=Color.LightBlue;
FpSpread1.Sheets[0].AlternatingRows[1].ForeColor=Color.DarkBlue;
FpSpread1.Sheets[0].AlternatingRows[2].BackColor=Color.Orange;
FpSpread1.Sheets[0].AlternatingRows[2].ForeColor=Color.DarkRed;
行扩充的处理如果一行有有过多的数据这些属性可以显示的样式
GetRowExpandableSetRowExpandable
设置固定行的样式首先定义一个样式
FarPoint.Web.Spread.StyleInfodarkstyle=newFarPoint.Web.Spread.StyleInfo();
darkstyle.BackColor=Color.Teal;
darkstyle.ForeColor=Color.Yellow;
然后将这个新样式设置到列头区域
FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle=darkstyle;
设置列头显示或者隐藏
FpSpread1.Sheets[0].ColumnHeader.Visible=false;
设置列头文本
FpSpread1.Sheets[0].ColumnHeader.Columns[0].Label="North";
FpSpread1.Sheets[0].ColumnHeader.Columns[1].Label="South";
定制行列头区域空的部分
FarPoint.Web.Spread.SheetViewsv=FpSpread1.ActiveSheetView;
sv.HeaderGrayAreaColor=Color.Red;
设置行列头数
FpSpread1.Sheets[0].ColumnHeader.RowCount=3;
FpSpread1.Sheets[0].RowHeader.ColumnCount=2;
合并
FpSpread1.Sheets[0].ColumnHeaderSpanModel.Add(0,0,1,8);
FpSpread1.Sheets[0].RowHeaderSpanModel.Add(0,0,12,1);
表头文本赋值
FpSpread1.Sheets[0].ColumnHeader.Cells[0,0].Text="FiscalYear2005";
FpSpread1.Sheets[0].RowHeader.Cells[0,0].Text="Branch#";
FpSpread1.Sheets[0].ColumnHeader.Cells[1,0].Text="1stQuarter";
指定单元格背景
FpSpread1.Sheets[0].Cells[0,0].BackColor=Color.Azure;
FpSpread1.Sheets[0].Cells[2,2,3,3].BackColor=Color.Bisque;
对齐样式
FpSpread1.Sheets[0].Cells[0,0].HorizontalAlign=HorizontalAlign.Right;
FpSpread1.Sheets[0].Cells[0,0].VerticalAlign=VerticalAlign.Top;
FpSpread1.Sheets[0].Cells[1,1,2,2].HorizontalAlign=HorizontalAlign.Center;
定义单元格边界
fpSpread1.Sheets[0].Cells[4,3].Border=newFarPoint.Web.Spread.Border(System.Web.UI.WebControls.BorderStyle.Double,Color.DarkBlue,2);
定义单元格内外边距
FarPoint.Web.Spread.Cellmycell;
FarPoint.Web.Spread.Insetmargin=newFarPoint.Web.Spread.Inset(20,40,50,20);
mycell=FpSpread1.Cells[0,0];
mycell.Value="Margin";
mycell.Locked=true;
mycell.Margin=margin;
FpSpread1.ActiveSheetView.Rows[0].Height=80;
自定义样式
FarPoint.Web.Spread.NamedStylebackstyle=newFarPoint.Web.Spread.NamedStyle("BlueBack");
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Fpspread1 控件 使用手册