Spread for ASP.NET 7.0 Product Documentation
Format Method
See Also  Example Support Options
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()>
Public Class myCombo
Inherits FarPoint.Web.Spread.ComboBoxCellType

Sub New()
MyBase.New(New String(){"One","Two","Three"},New String(){"1","2","3"})
End Sub

Public Overrides Function Format(ByVal o As Object)As String
Return MyBase.Format(o)
End Function

Public Overrides Function GetEditorControl(ByVal id As String,ByVal tc As TableCell,ByVal style As FarPoint.Web.Spread.Appearance,ByVal margin As FarPoint.Web.Spread.Inset,ByVal v As Object,ByVal ul As Boolean)As System.Web.UI.Control
Return MyBase.GetEditorControl(id,tc,style,margin,v,ul)
End Function

Public Overrides Function PaintCell(ByVal id As String,ByVal tc As TableCell,ByVal style As FarPoint.Web.Spread.Appearance,ByVal margin As FarPoint.Web.Spread.Inset,ByVal v As Object,ByVal ul As Boolean)As System.Web.UI.Control
Return MyBase.PaintCell(id,tc,style,margin,v,ul)
End Function

Public Overrides Function Parse(ByVal s As String)As Object
Return MyBase.Parse(s)
End Function

Public Overrides ReadOnly PropertyEditorClientScriptUrl()As String
Get
Return"listboxeditor.htc"
End Get
End Property

End Class

Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
Dim cb As New myCombo()
FpSpread1.ActiveSheetView.Cells(0,0).CellType=cb
End Sub
C#Copy Code
[Serializable()]
class myCombo:FarPoint.Web.Spread.ComboBoxCellType
{
ArrayList items=new ArrayList();
ArrayList values=new ArrayList();

public myCombo(string[]items):base(items)
{
for(int i=0;i<items.Length;i++)
{
this.items.Add(items[i]);
}
}

public override string Format(object o)
{
return base.Format(o);
}

public override ControlGetEditorControl(string id,TableCell tc,FarPoint.Web.Spread.Appearance style,FarPoint.Web.Spread.Inset margin,object v,bool ul)
{
returnbase.GetEditorControl(id,tc,style,margin,v,ul);
}

public override ControlPaintCell(string id,TableCell tc,FarPoint.Web.Spread.Appearance style,FarPoint.Web.Spread.Inset margin,object v,bool ul)
{
return base.PaintCell(id,tc,style,margin,v,ul);
}

public override object Parse(string s)
{
return base.Parse(s);
}

public override string EditorClientScriptUrl{get{return"listboxeditor.htc";}}
}

private void Page_Load(object sender,System.EventArgs e)
{
myCombo cb=new myCombo(new string[]{"One","Two","Three"});
FpSpread1.ActiveSheetView.Cells[0,0].CellType=cb;
}

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.