Spread ASP.NET 6.0 Product Documentation
Format Method
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > ComboBoxCellType Class : Format Method


o
Object in the data model from which to get formatting information

Glossary Item Box

When deriving a cell type based on this type, override this to change what gets passed back and formatted as a string into the cell on the sheet from the object in the data model.

Syntax

Visual Basic (Declaration) 
Public Overrides Function Format( _
   ByVal o As Object _
) As String
Visual Basic (Usage)Copy Code
Dim instance As ComboBoxCellType
Dim o As Object
Dim value As String
 
value = instance.Format(o)
C# 
public override string Format( 
   object 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 sheet

Example

The 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 BasicCopy 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;
}

Requirements

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

See Also

© 2002-2012 GrapeCity, Inc. All Rights Reserved.