Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As ComboBoxCellType Dim o As Object Dim value As String value = instance.Format(o) |
Parameters
- o
- Object in the data model from which to get formatting information
Return Value
Formatted string to put in the cell on the sheetThe following example subclasses the ComboBoxCellType class and creates a combo box cell in the first cell of the spreadsheet. To view the combox, double-click in the first cell.
Visual Basic | Copy Code |
---|---|
<Serializable()> PublicClassmyCombo InheritsFarPoint.Web.Spread.ComboBoxCellType SubNew() MyBase.New(NewString(){"One","Two","Three"},NewString(){"1","2","3"}) EndSub PublicOverridesFunctionFormat(ByValoAsObject)AsString ReturnMyBase.Format(o) EndFunction PublicOverridesFunctionGetEditorControl(ByValidAsString,ByValtcAsTableCell,ByValstyleAsFarPoint.Web.Spread.Appearance,ByValmarginAsFarPoint.Web.Spread.Inset,ByValvAsObject,ByValulAsBoolean)AsSystem.Web.UI.Control ReturnMyBase.GetEditorControl(id,tc,style,margin,v,ul) EndFunction PublicOverridesFunctionPaintCell(ByValidAsString,ByValtcAsTableCell,ByValstyleAsFarPoint.Web.Spread.Appearance,ByValmarginAsFarPoint.Web.Spread.Inset,ByValvAsObject,ByValulAsBoolean)AsSystem.Web.UI.Control ReturnMyBase.PaintCell(id,tc,style,margin,v,ul) EndFunction PublicOverridesFunctionParse(ByValsAsString)AsObject ReturnMyBase.Parse(s) EndFunction PublicOverridesReadOnlyPropertyEditorClientScriptUrl()AsString Get Return"listboxeditor.htc" EndGet EndProperty EndClass PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load DimcbAsNewmyCombo() FpSpread1.ActiveSheetView.Cells(0,0).CellType=cb EndSub |
C# | Copy Code |
---|---|
[Serializable()] classmyCombo:FarPoint.Web.Spread.ComboBoxCellType { ArrayListitems=newArrayList(); ArrayListvalues=newArrayList(); publicmyCombo(string[]items):base(items) { for(inti=0;i<items.Length;i++) { this.items.Add(items[i]); } } publicoverridestringFormat(objecto) { returnbase.Format(o); } publicoverrideControlGetEditorControl(stringid,TableCelltc,FarPoint.Web.Spread.Appearancestyle,FarPoint.Web.Spread.Insetmargin,objectv,boolul) { returnbase.GetEditorControl(id,tc,style,margin,v,ul); } publicoverrideControlPaintCell(stringid,TableCelltc,FarPoint.Web.Spread.Appearancestyle,FarPoint.Web.Spread.Insetmargin,objectv,boolul) { returnbase.PaintCell(id,tc,style,margin,v,ul); } publicoverrideobjectParse(strings) { returnbase.Parse(s); } publicoverridestringEditorClientScriptUrl{get{return"listboxeditor.htc";}} } privatevoidPage_Load(objectsender,System.EventArgse) { myCombocb=newmyCombo(newstring[]{"One","Two","Three"}); FpSpread1.ActiveSheetView.Cells[0,0].CellType=cb; } |
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family