FpSpread的基本用法

2021-04-13 21:56:10 字數 4869 閱讀 4932

我簡要說明一下spread的用法:  

1,   在呼叫的.aspx頁面開頭註冊:  

"farpoint.web.spread"   assembly="farpoint.web.spreadj,   version=2.0.1.0,   culture=neutral,   publickeytoken=a5fa960294d899e7"   %>    

2,將控制項加入到.aspx頁面中:  

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("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的虛擬目錄就可以了!  

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.scrollba***cecolor = 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));

mysql 的基本用法 mysql基本用法

mysql 5.1 中文參考手冊 show databases 顯示資料庫 drop database 資料庫名 刪除資料庫 set names utf8 設定資料庫編碼為utf 8 source x 資料庫名.sql 匯入乙個資料庫 use 資料庫名 嘗試訪問資料庫 create database...

mysql 的基本用法 mysql基本用法

mysql 5.1 中文參考手冊 show databases 顯示資料庫 drop database 資料庫名 刪除資料庫 set names utf8 設定資料庫編碼為utf 8 source x 資料庫名.sql 匯入乙個資料庫 use 資料庫名 嘗試訪問資料庫 create database...

this的基本用法

this 代表所在類的物件的引用。方法被那個物件呼叫,this就代表哪個物件,簡單的說,他就代表當前類的乙個物件。注意 誰呼叫這個方法,在方法內部的this就代表誰。this的應用場景 解決區域性變數,隱藏成員變數。class student 姓名設定值 public void setname st...