Fpspread1控件使用手册
更新时间:2023-11-01 04:25:01 阅读量: 综合文库 文档下载
Fpspread1控件使用手册:
数据类型的使用:
Setting 0 - Date 1 - Edit 4 - PIC 6 - Time 7 - Button 9 - Picture
Description
Creates date cell Creates PIC cell Creates time cell Creates button cell Creates picture cell
Constant CellTypeDate CellTypePic CellTypeTime CellTypeButton CellTypeComboBox CellTypePicture CellTypeCheckBox CellTypeCurrency CellTypeNumber CellTypePercent CellTypeScientific
(Default) Creates edit cell CellTypeEdit
5 - Static Text Creates static text cell CellTypeStaticText
8 - Combo Box Creates combo box cell 10 - Check Box Creates check box cell 12 - Currency Creates currency cell 13 - Number 14 - Percent
Creates numeric cell Creates percent cell
11 - Owner-Drawn Creates owner-drawn cell CellTypeOwnerDrawn
15 - Scientific Creates scientific cell
一、日期型的使用
ShortDaysUs = \星期一\
LongDaysUs = \星期一\
ShortMonthsUs = \一月\\
LongMonthsUs = \一月\Y\\Fpspread1.col=1
fpspread1. Value=date
fpspread1.CellType =CellTypeDate
Call fpspread1.SetCalText(ShortDaysUs, LongDaysUs, ShortMonthsUs, LongMonthsUs, \二、下拉框的使用 fpSpread1.Row = 2 fpSpread1.Col = 2
fpSpread1.CellType = CellTypeComboBox
fpSpread1.TypeComboBoxList = \\
fpSpread1.TypeComboBoxString = \fpSpread1.TypeComboBoxString = \fpSpread1.TypeComboBoxEditable = True fpSpread1.TypeComboBoxMaxDrop = 5
fpSpread1.TypeComboBoxCurSel = 0 fpSpread1.TypeComboBoxWidth = 0 三、换行
fpSpread1.TypeEditMultiLine = True
fpSpread1.Text = \ cellheight = fpSpread1.MaxTextCellHeight fpSpread1.RowHeight(3) = cellheight 四、当前单元格的数据: Private Sub Command1_Click()
fpSpread1.Row = fpSpread1.ActiveRow fpSpread1.Col = fpSpread1.ActiveCol Text1.Text = fpSpread1.Text End Sub
五、不能调整每一列大小
fpSpread1.UserResize = SS_USER_RESIZE_NONE fpSpread1.SetActiveCell 4, 3 ‘得到光标
六、这个函数的主要作用是指定范围的单元格是否可编辑。 fpSpread1.EditModePermanent = True
Sub LockCells(Col As Long, col2 As Long, Row As Long, row2 As Long, celllock As Boolean)
fpSpread1.Col = Col fpSpread1.col2 = col2 fpSpread1.Row = Row fpSpread1.row2 = row2
fpSpread1.BlockMode = True fpSpread1.Lock = celllock fpSpread1.BlockMode = False End Sub
七、控制网络线
fpSpread1.GridShowHoriz = False ‘列线
fpSpread1.GridShowVert = False ‘行线 fpSpread1.GridSolid = True
fpSpread1.GridColor = RGB(0, 0, 0) 八、公式的设置
fpSpread1.Col = 4 fpSpread1.Row = 7
fpSpread1.Formula = \fpSpread1.Formula = \
1, 在调用的.aspx页面开头注册:
\Assembly=\Version=2.0.1.0, PublicKeyToken=a5fa960294d899e7\%> 2,将控件加入到.aspx页面中:
Culture=neutral,
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[] {\\\\\\\\\\\new string[] {\\\\\\\\\\\ cb.ShowButton=true;
FpSpread1.Sheets[0].Cells[4, 2].CellType = cb; //表中向k行第一列加入CheckBox列
FarPoint.Web.Spread.CheckBoxCellType ckb = new FarPoint.Web.Spread.CheckBoxCellType(\\
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 = \Cell Editor/Renderer\
FpSpread1.ActiveSheetView.Cells[0, 2].Text = \from editor are RGB of BackColor\指定控件区域大小
FpSpread1.Height = Unit.Pixel(300); FpSpread1.Width = Unit.Pixel(763); 设置列的类型
FarPoint.Web.Spread.CheckBoxCellType objIntCell = new FarPoint.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.SheetView newsheet = new FarPoint.Web.Spread.SheetView(); newsheet.SheetName = \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.SheetSkin myskin = new FarPoint.Web.Spread.SheetSkin(\Color.BlanchedAlmond, Color.Bisque, Color.Navy, 2, Color.Blue, GridLines.Both, Color.Beige, Color.BurlyWoo
d, 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; 行扩充的处理 如果一行有有过多的数据 这些属性可以显示的样式 GetRowExpandable SetRowExpandable 设置固定行的样式 首先定义一个样式
FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.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 = \FpSpread1.Sheets[0].ColumnHeader.Columns[1].Label = \定制行列头区域空的部分
FarPoint.Web.Spread.SheetView sv = 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 = \Year 2005\FpSpread1.Sheets[0].RowHeader.Cells[0, 0].Text = \#\FpSpread1.Sheets[0].ColumnHeader.Cells[1, 0].Text = \Quarter\ 指定单元格背景
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 = new FarPoint.Web.Spread.Border(System.Web.UI.WebControls.BorderStyle. Double, Color.DarkBlue, 2); 定义单元格内外边距
FarPoint.Web.Spread.Cell mycell;
FarPoint.Web.Spread.Inset margin = new FarPoint.Web.Spread.Inset(20, 40, 50, 20); mycell = FpSpread1.Cells[0, 0]; mycell.Value = \mycell.Locked = true; mycell.Margin = margin;
FpSpread1.ActiveSheetView.Rows[0].Height = 80; 自定义样式
FarPoint.Web.Spread.NamedStyle backstyle = new FarPoint.Web.Spread.NamedStyle(\k\
backstyle.BackColor = Color.Blue;
FarPoint.Web.Spread.NamedStyle text1style = new FarPoint.Web.Spread.NamedStyle(\ext\\
text1style.ForeColor = Color.Orange;
FarPoint.Web.Spread.NamedStyle text2style = new FarPoint.Web.Spread.NamedStyle(\ext\\
text2style.ForeColor = Color.Yellow; FpSpread1.NamedStyles.Add(backstyle); FpSpread1.NamedStyles.Add(text1style);
FpSpread1.NamedStyles.Add(text2style);
FpSpread1.ActiveSheetView.Cells[0,0,2,0].StyleName = \FpSpread1.ActiveSheetView.Cells[0,1,2,1].StyleName = \使用css
FarPoint.Web.Spread.GeneralCellType mycelltype = new FarPoint.Web.Spread.GeneralCellType();
myCellType.CssClass = \
FpSpread1.ColumnHeader.Cells[0, 0].CellType = myCellType; FpSpread1.Cells[0, 1].CellType = myCellType; 创建一个区域
FarPoint.Web.Spread.Cell range1;
range1 = fpSpread1.ActiveSheetView.Cells[1, 1, 3, 3]; range1.Value = \Here\
range1.Note = \is the note that describes the value.\添加合并单元
FpSpread1.ActiveSheetView.Cells[1,1].Text = \six cells are spanned.\ FpSpread1.ActiveSheetView.Cells[2,2].Text = \is text in 2,2.\ FpSpread1.ActiveSheetView.AddSpanCell(1, 1, 2, 3); 自动合并相同行列
FpSpread1.Sheets[0].SetRowMerge(-1, FarPoint.Web.Spread.Model.MergePolicy.Always); FpSpread1.Sheets[0].SetColumnMerge(-1, FarPoint.Web.Spread.Model.MergePolicy.Always); 设置滚动条
FpSpread1.HorizontalScrollBarPolicy = ScrollBarPolicy.Always; FpSpread1.VerticalScrollBarPolicy = ScrollBarPolicy.AsNeeded; 设置滚动条的颜色
FpSpread1.ScrollBar3DLightColor = Color.Yellow; FpSpread1.ScrollBarArrowColor = Color.Green; FpSpread1.ScrollBarBaseColor = Color.Brown; FpSpread1.ScrollBarDarkShadowColor = Color.Purple; FpSpread1.ScrollBarFaceColor = Color.Orange; FpSpread1.ScrollBarHighlightColor = Color.White; FpSpread1.ScrollBarShadowColor = Color.Blue; FpSpread1.ScrollBarTrackColor = Color.Pink; 展示AllowLoadOnDemand和LoadInitRowCount属性 FpSpread1.Sheets[0].RowCount = 40;
FpSpread1.Sheets[0].AllowLoadOnDemand = True; FpSpread1.Sheets(0).PageSize = 40
FpSpread1.Sheets[0].LoadInitRowCount = 10; long i;
for (i = 1; i <= 20; i++)
{FpSpread1.Sheets[0].Cells[i, 0].Value = i; } TabKey
FpSpread1.ProcessTab = false; 定义tab的样式
FpSpread1.Sheets.Count = 3;
FarPoint.Web.Spread.TabInfo().TabControlPolicy = FarPoint.Web.Spread.TabControlPolicy.Always;
FpSpread1.Tab.VisibleCount = 2; FpSpread1.Tab.ScrollIncrement = 2;
FpSpread1.Tab.FirstVisibleTab = 1; FpSpread1.Tab.TextColor = Color.Yellow;
FpSpread1.Tab.ActiveTabBackColor = Color.Green; FpSpread1.Tab[0] = \ FpSpread1.Tab[1] = \ FpSpread1.Tab[2] = \切换工作表是否ajax支持
FpSpread1.EnableAjaxCall = true; FpSpread1.ClientAutoCalculation = true;
在工作表中搜索指定的内容
fpSpread1.Search(2,\rowindx,ref colindx));
1.获得当前行的行号,列号,总列数,总行数
int rowCount = fpSpread1.ActiveSheet.RowCount;
int colCount = fpSpread1.ActiveSheet.Columns.Count; int activeRow = fpSpread1.ActiveSheet.ActiveRowIndex; int activeCol = fpSpread1.ActiveSheet.ActiveColumnIndex;
2.设置单元格格式时候用 MultiColumnComboBoxCellType 是注意:只能用字符类型字段的选择。要想用数字字段选择的话须将数字类型转换为字符型即可。
FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType mCombox = new FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType();
mCombox.ColumnEditName = \ mCombox.DataColumnName = \ mCombox.ListWidth = 556; mCombox.MaxDrop = 8;
mCombox.DataSourceList = dataset;
fpSpread1.ActiveSheet.Columns[0].Label = \ fpSpread1.ActiveSheet.Columns[0].CellType = mCombox;
3.问题:当下拉mCombox 中的数据少时会出现空白单元格,目前还不知道咋回事!
4.增加和删除行
fpSpread1.ActiveSheet.Rows.Add(rowCount, rows);rowCount是添加行的起始位置,rows是添加的行数。
fpSpread1.ActiveSheet.Rows.Remove(rowCount, rows);rowCount是删除行的起始位置,rows删除的行数。
5.
if (fpSpread1.ActiveSheet.ActiveRow.Index == fpSpread1.ActiveSheet.RowCount - 1) //如果是到最后一行则增加一行 {
if (e.KeyCode == Keys.Down) {
DetailAdd(); } }
if (e.KeyCode == Keys.Delete) //按delete键可删除当前活动单元格内容 {
fpSpread1.ActiveSheet.ActiveCell.ResetValue(); }
if (e.KeyCode == Keys.Enter) //按Enter键跳到下一单元格 {
int rowCount = fpSpread1.ActiveSheet.RowCount;
int colCount = fpSpread1.ActiveSheet.Columns.Count; int activeRow = fpSpread1.ActiveSheet.ActiveRowIndex; int activeCol = fpSpread1.ActiveSheet.ActiveColumnIndex; if (activeCol != (colCount-1)) {
fpSpread1.ActiveSheet.SetActiveCell(activeRow, activeCol + 1); }
else if( activeRow != (rowCount - 1)) {
fpSpread1.ActiveSheet.SetActiveCell(activeRow+1,0); } }
6.移除选择的多行
int rowCount = fpSpread1.ActiveSheet.RowCount;
for (int row = 0; row < rowCount; row++) //移除选择行 {
if (fpSpread1.ActiveSheet.IsSelected(row, 1) == true)
{ fpSpread1.ActiveSheet.Rows.Remove(row, 1); } }
7.剪切,复制,粘贴
//剪切:
FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction cutAction = new FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction(); fpSpread1.UndoManager.PerformUndoAction(cutAction); //复制
detail.ActiveSheet.ClipboardCopy();
//粘贴
FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction pasteAction = new FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction(ClipboardPasteOptions.All); detail.UndoManager.PerformUndoAction(pasteAction);
SheetView sv = fpSpread1.ActiveSheet; if (sv == null) return;
int activeRow = sv.ActiveRowIndex;
int activeColumn = sv.ActiveColumnIndex; if (sender == menuCut) //剪切 {
FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction cutAction = new FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction();
fpSpread1.UndoManager.PerformUndoAction(cutAction); }
else if (sender == menuCopy) //复制 {
sv.ClipboardCopy(); }
else if (sender == menuPaste) //粘贴 {
FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction pasteAction = new FarPoint.Win.Spread.UndoRedo.ClipboardPasteUndoAction(ClipboardPasteOptions.All); fpSpread1.UndoManager.PerformUndoAction(pasteAction); }
else if (sender == menuInsertRow) //插入一行 {
sv.Rows.Add(activeRow, 1); }
else if (sender == menuInsertColumn)//插入一列 {
sv.Columns.Add(activeColumn, 1); }
else if (sender == menuRemoveRow)//删除一行 {
sv.Rows.Remove(activeRow, 1); }
else if (sender == menuRemoveColumn)//删除一列 {
sv.Columns.Remove(activeColumn, 1); }
else if (sender == menuClearContents) //清除内容 {
FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction cutAction = new FarPoint.Win.Spread.UndoRedo.ClipboardCutUndoAction();
fpSpread1.UndoManager.PerformUndoAction(cutAction); }
8.撤销,恢复
//撤销
FarPoint.Win.Spread.InputMap im;
im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
im.Put(new FarPoint.Win.Spread.Keystroke(Keys.U, Keys.None), FarPoint.Win.Spread.SpreadActions.Undo); //恢复
FarPoint.Win.Spread.InputMap im;
im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
im.Put(new FarPoint.Win.Spread.Keystroke(Keys.E, Keys.None), FarPoint.Win.Spread.SpreadActions.Redo);
9.Find,Filter,Sort
//允许列排序
this.fpSpread1_Sheet1.Columns.Get(0).AllowAutoSort = true; //允许列过滤
fpSpread1.ActiveSheet.Columns.Get(1).AllowAutoFilter = true; //查找
fpSpread1.SearchWithDialogAdvanced(0, 4, \
正在阅读:
Fpspread1控件使用手册11-01
啤酒游戏总结报告10-09
高中物理第3章液体31液体的表面张力教案鲁科版选修3 312-30
2014美国硕士专业就业前景排行榜06-06
施工总结报告范文09-01
高校绿色化学实验室建设的探讨06-02
郎外河电站施组205-16
生活部总结报告03-28
县审计局主要业务完成情况年度工作总结报告03-20
岗位认知总结报告07-28
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 控件
- Fpspread1
- 手册
- 使用
- 二年级语文下册第一单元第一课《找春天》作
- 李刚讲话
- 《国际贸易实务》项目一、二单元测验卷
- 后勤基地可研
- 领导干部如何提高处置突发事件的能力
- 2016 - 2017学年七年级语文上学期第三次月考(12月)试题
- 理解性默写题目
- 供电技术 第四版课后习题答案
- 窗外人生 王呈伟阅读附答案word版本(3页)
- 智商测试题100道-HR - 图文
- 2014年黑龙江教师招聘考试每日一练(2.11)
- 仿写比喻句、拟人句大全 Microsoft Word 文档
- 机械精密度加工及其工艺分析
- 锌精矿沸腾焙烧设计
- 小学语文“群文阅读”教学模式初探
- 2014年上半年幼儿园教师资格考试真题
- 计算机一级考试试题汇总
- 2-漳州市教育局文件
- 差旅费管理办法
- 西安地铁四号线王斌20161029工作总结