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 obj As Object _
) As String |
Parameters
- obj
- 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 CurrencyCellType class and creates a currency cell in the first cell of the spreadsheet.
C# | Copy Code |
---|
[Serializable()]
classmyCombo:FarPoint.Web.Spread.ComboBoxCellType
{
publicoverridestringFormat(objecto)
{
returnbase.Format(o);
}
publicoverrideBaseValidatorGetValidator()
{
returnbase.GetValidator();
}
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);
}
publicoverrideboolValidateEditorValue(objectval,outstringreason)
{
returnbase.ValidateEditorValue(val,outreason);
}
}
privatevoidPage_Load(objectsender,System.EventArgse)
{
myCurrcurr=newmyCurr();
FpSpread1.ActiveSheetView.Cells[0,0].CellType=curr;
FpSpread1.ActiveSheetView.SetCellValue(0,0,99.95);
} |
Visual Basic | Copy Code |
---|
<Serializable()>
PublicClassmyCurr
InheritsFarPoint.Web.Spread.CurrencyCellType
PublicOverridesFunctionFormat(ByValoAsObject)AsString
ReturnMyBase.Format(o)
EndFunction
PublicOverridesFunctionGetValidator()AsBaseValidator
ReturnMyBase.GetValidator
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
PublicOverridesFunctionValidateEditorValue(ByValvalAsObject,ByRefreasonAsString)AsBoolean
ReturnMyBase.ValidateEditorValue(val,reason)
EndFunction
EndClass
PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
DimcurrAsNewmyCurr()
FpSpread1.ActiveSheetView.Cells(0,0).CellType=curr
FpSpread1.ActiveSheetView.SetCellValue(0,0,99.95)
EndSub |
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