资源描述:
《fpspread 葵花宝典》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、fpvaspread详解Withvaspread.DeleteRows1,1--删除第一列第一行数据.Col=-1:.Row=-1:.Lock=False--设置vaspread为解锁状态.AllowUserFormulas=False‘不允许格式化.MaxCols=67'58‘设置最大列数.MaxRows=300‘设置显示行的最大数.ColHeaderRows=1'2将头换成1行.UserColAction=UserColActionSort'表头是否排序'.AddCellSpan1,SpreadHeader,17,1'16c
2、hange17‘设置显示标题栏格式'.Col=1:.Row=SpreadHeader:.Text="基本信息"‘设置列名.Col=COL_ID:.Row=SpreadHeader:.Text="序号"'SpreadHeader+1控制显示的行'SpreadHeader+1DateField为绑定的数据表字段colhidden是否为隐藏‘Colwidth设置显示的列的宽度.Col=COL_FID:.Row=SpreadHeader:.DataField="FID":.Text="表体唯一号":.ColHidden=True:。Co
3、lWidth(1)=12'‘SpreadHeader+1‘格式化列表.CellType=CellTypeDate日期.Col=FhwBoolIn(2,"FStartDate"):.CellType=CellTypeDate:.TypeDateFormat=TypeDateFormatYYMMDD‘设置数字.CellType=CellTypeNumber'.Col=FhwBoolIn(2,"FThickness"):.CellType=CellTypeNumber:.TypeNumberDecPlaces=2:.TypeNumbe
4、rShowSep=True:.TypeHAlign=TypeHAlignRight‘设置文本型.CellType=CellTypeEdit:.Col=FhwBoolIn(2,"FDescriptionCust"):.TypeEditMultiLine=True:.CellType=CellTypeEdit:.AutoSize=True‘自动换行换列PrivateSubEntrerCtrlCol(ByValKeyCodeAsLong)'Enter换行WithvaspreadIfKeyCode=13Then‘获取回车事件If.Max
5、Cols<>.ActiveColThen。如果当前列不等于最大列,则换行否则换列.SetActiveCell.ActiveCol+1,.ActiveRow.SetFocusElse.SetActiveCell1,.ActiveRow+1.SetFocusEndIfEndIfEndWithEndSub‘获取值Dimpvalueasvariantvaspread.GetTextvaspread.ActiveCol,vaspread.ActiveRow,pvalue‘pvalue为获取的值vaspread.SetTextvasprea
6、d.ActiveCol,vaspread.ActiveRow,pvalue‘pvalue需要给赋予的值‘设置行底色一级边框颜色‘第一行设置背景颜色,第二行设置边框颜色Withvasperad.Col=-1:.Row=Row:.BackColor=&HC0C0C0:.BackColorStyle=BackColorStyleUnderGrid.Col=-1:.Row=Row:.BorderStyle=BorderStyleFixedSingle:.BackColor=&H80000018Endwith‘复制行Withvasprea
7、d.InsertRowsvaspread.ActiveRow+1,1Fori=0To.MaxCols.Col=i.GetTexti,.ActiveRow,TempIfi=FhwBoolIn(2,"FDescriptionYard")Ori=FhwBoolIn(2,"FDescriptionCust")ThenTemp=Temp&"".SetTexti,.ActiveRow+1,Tempvaspread.ColWidth(FhwBoolIn(2,"FDescriptionCust"))=20vaspread.ColWidth(Fh
8、wBoolIn(2,"FDescriptionYard"))=20iHeight=Len(Temp)/13IfRight(FormatNumber(iHeight),1)>5TheniHeightTemp=Round(iHeight,0)ElseiHeightT