FpSpread基本句法
1, 在调用的.aspx页面开头注册:
"FarPoint.Web.Spread" Assembly="FarPoint.Web.SpreadJ, Version=2.0.1.0, Culture=neutral, PublicKeyToken=a5fa960294d899e7" %>
2,将控件加入到.aspx页面中:
<farpoint:fpspread id="FpSpread1" style="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 104px" runat="server" width="448px" height="223px">
<commandbar buttonshadowcolor="ControlDark" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" backcolor="Control"></commandbar>
<sheets>
<farpoint:sheetview sheetname="Sheet1"></farpoint:sheetview>
</sheets>
</farpoint: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 = "Custom Cell Editor/Renderer";
FpSpread1.ActiveSheetView.Cells[0, 2].Text = "Values 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 = "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.SheetSkin myskin = new FarPoint.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;
行扩充的处理 如果一行有有过多的数据 这些属性可以显示的样式
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 = "North";
FpSpread1.Sheets[0].ColumnHeader.Columns[1].Label = "South";
定制行列头区域空的部分
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 = "Fiscal Year 2005";
FpSpread1.Sheets[0].RowHeader.Cells[0, 0].Text = "Branch #";
FpSpread1.Sheets[0].ColumnHeader.Cells[1, 0].Text = "1st 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 = "Margin";
mycell.Locked = true;
mycell.Margin = margin;
FpSpread1.ActiveSheetView.Rows[0].Height = 80;
自定义样式
FarPoint.Web.Spread.NamedStyle backstyle = new FarPoint.Web.Spread.NamedStyle("BlueBack");
backstyle.BackColor = Color.Blue;
FarPoint.Web.Spread.NamedStyle text1style = new FarPoint.Web.Spread.NamedStyle("OrangeText", "BlueBack");
text1style.ForeColor = Color.Orange;
FarPoint.Web.Spread.NamedStyle text2style = new FarPoint.Web.Spread.NamedStyle("YellowText", "BlueBack");
text2style.ForeColor = Color.Yellow;
FpSpread1.NamedStyles.Add(backstyle);
FpSpread1.NamedStyles.Add(text1style);
FpSpread1.NamedStyles.Add(text2style);
FpSpread1.ActiveSheetView.Cells[0,0,2,0].StyleName = "OrangeText";
FpSpread1.ActiveSheetView.Cells[0,1,2,1].StyleName = "YellowText";
使用css
FarPoint.Web.Spread.GeneralCellType mycelltype = new FarPoint.Web.Spread.GeneralCellType();
myCellType.CssClass = "myCssClass";
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 = "Value Here";
range1.Note = "This is the note that describes the value.";
添加合并单元
FpSpread1.ActiveSheetView.Cells[1,1].Text = "These six cells are spanned.";
FpSpread1.ActiveSheetView.Cells[2,2].Text = "This 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] = "First";
FpSpread1.Tab[1] = "Second";
FpSpread1.Tab[2] = "Third";
切换工作表是否ajax支持
FpSpread1.EnableAjaxCall = true;
FpSpread1.ClientAutoCalculation = true;
在工作表中搜索指定的内容
fpSpread1.Search(2,"Total",true,true,false,false,1,1,56,56,ref rowindx,ref colindx));
FpSpread基本句法的更多相关文章
- mysql 命令重命名表RENAME TABLE 句法
mysql 命令重命名表RENAME TABLE 句法 RENAME TABLE tbl_name TO new_tbl_name[, tbl_name2 TO new_tbl_name2,...]更 ...
- H264的句法和语法总结(一)分层结构
在H.264 中,句法元素共被组织成 序列.图像.片.宏块.子宏块五个层次.在这样的结构中,每一层的头部和它的数据部分形成管理与被管理的强依赖关系,头部的句法元素是该层数据的核心,而一旦头部丢失,数 ...
- EXPLAIN句法 优化表结构
EXPLAIN tbl_name or EXPLAIN SELECT select_options EXPLAIN tbl_name是DESC[RIBE] tbl_name或SHOW COLUMNS ...
- .NET SQL Server连接字符串句法
.NET SQL Server连接字符串句法 数据库的连接性已经发展成为应用程序开发的一个标准方面.数据库连接字符串现在已经成为每个项目的标准必备条件.我发现自己为了找到所需要的句法,经常要从另外一个 ...
- FpSpread添加表头(列名)标注
for (int j = 0; j < fp.ActiveSheetView.ColumnCount; j++) { fp.ActiveSheetView.ColumnHeader.Cells[ ...
- H264标准句法表中C的含义理解
下面一段是H264官方中文版中给出的解释: “类别(在表中以C 表示)规定条带数据可以至多划分为三种条带数据类别.条带数据类别A 包含了类别2的所有语法元素.条带数据类别B 包含了类别3 的所有语法元 ...
- 14.7.1.2 MySQL创建用户句法
14.7.1.2 CREATE USER Syntax 单击此处查看原文 以下是MySQL 5.7.6及以上版本的CREATE USER句法 CREATE USER [IF NOT EXISTS] u ...
- NLP+句法结构(三)︱中文句法结构(CIPS2016、依存句法、文法)
摘录自:CIPS2016 中文信息处理报告<第一章 词法和句法分析研究进展.现状及趋势>P8 -P11 CIPS2016> 中文信息处理报告下载链接:http://cips-uplo ...
- 转:NLP+句法结构(三)︱中文句法结构(CIPS2016、依存句法、文法)
NLP+句法结构(三)︱中文句法结构(CIPS2016.依存句法.文法)转自:https://www.cnblogs.com/maohai/p/6453389.html 摘录自:CIPS2016 中文 ...
随机推荐
- 代码大全读书笔记 Part 1
简单的看了前言,印象最深的还是这本书崇尚"绝不注水"的原则.现实生活中,不仅仅有注水牛肉,瘦肉精的猪肉,很多书籍也是东拼西凑来的内容,不注水的厚书,是十分令人期待的. 第一章:欢迎 ...
- 【转】python通过文件头判断文件类型
刚刚看到一个好玩的程序,拉过来.原文地址:https://www.ttlsa.com/python/determine-file-type-by-the-file-header/ 侵权删. ===== ...
- GCD学习(五) dispatch_barrier_async
先看段代码 dispatch_queue_t concurrentQueue = dispatch_queue_create("my.concurrent.queue", DISP ...
- Adobe flash player 因过期而遭到阻止解决办法
最近使用谷歌浏览器时总是提示Adobe flash player 因过期而遭到阻止,这让人很头痛,基本上就是打开一个网页就会弹出一个提示,下面是解决办法. 问题的截图界面: 解决方法:在chrome浏 ...
- 【[SCOI2010]股票交易】
感谢dzm,尽管接受了\(The \text{ }\text{ }king\text{ } \text{ }of\text{ } \text{ }SD\)的指点但我还是不会 至少方程还是比较好推的 状 ...
- 4springboot:日志(上)
1.主流的日志框架 2.SLF4J使用 如何在系统中使用SLF4j https://www.slf4j.org 以后开发的时候,日志记录方法的调用,不应该来直接调用日志的实现类,而是调用日志抽象层里面 ...
- Linux 进程与信号的概念和操作 linux process and signals
进程 主要参考: http://www.bogotobogo.com/Linux/linux_process_and_signals.php 译者:李秋豪 信号与进程几乎控制了操作系统的每个任务. 在 ...
- oracle 通配符及regexp_count函数说明
通配符 通配符描述示例 %:匹配包含零个或更多字符的任意字符串.WHERE title LIKE '%computer%' 将查找处于书名任意位置的包含单词 computer 的所有书名. ...
- 从数据库中取出的数据,字段名为gb2312的 数据转码为utf8
$pj = Pj::find()->where($map)->asArray()->one(); if(!empty($pj)) { foreach ($pj as $k=>$ ...
- webpack执行命令失败之解决办法
错误信息:ERROR in multi ./runoob1.js bundle.js Module not found: Error: Can't resolve 'bundle.js' in 'C: ...