Spread ASP.NET 6.0 Product Documentation
Format Method
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > CheckBoxCellType 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 CheckBoxCellType
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 CheckBoxCellType class and creates a check box cell in the first cell of the spreadsheet. Its checked and unchecked images are set in the constructor and it uses the values of 0 or 1 for the check box state.
C#Copy Code
[Serializable()]
classmyCheck:FarPoint.Web.Spread.CheckBoxCellType
{
PublicmyCheck(stringimg1,stringimg2)
{
Base.CheckedImageUrl=img1;
Base.UncheckedImageUrl=img2;
}

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);
}

PublicoverrideobjectGetEditorValue(Controlowner,stringid)
{
ReturnBase.GetEditorValue(owner,id);
}

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);
}

NewPublicboolBooleanValue
{
Get
{
ReturnBase.BooleanValue;
}
Set
{
Base.BooleanValue=value;
}
}

PublicoverridestringEditorClientScriptUrl{Get{Return"checkboxeditor.htc";}}

PublicoverridestringRendererClientScriptUrl{Get{Return"checkboxrender.htc";}}

}

PrivatevoidPage_Load(objectsender,System.EventArgse)
{
myCheckckbox=NewmyCheck("img/checked.gif","img/unchecked.gif");
ckbox.BooleanValue=False;
FpSpread1.ActiveSheetView.Cells[0,0].CellType=ckbox;
FpSpread1.ActiveSheetView.SetCellValue(0,0,1);
}
Visual BasicCopy Code
<Serializable()>
PublicClassmyCheck
InheritsFarPoint.Web.Spread.CheckBoxCellType

SubNew(ByValimg1AsString,ByValimg2AsString)
MyBase.CheckedImageUrl=img1
MyBase.UncheckedImageUrl=img2
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

PublicOverridesFunctionGetEditorValue(ByValownerAsControl,ByValidAsString)AsObject
ReturnMyBase.GetEditorValue(owner,id)
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

PublicShadowsPropertyBooleanValue()AsBoolean
Get
ReturnMyBase.BooleanValue
EndGet
Set(ByValValueAsBoolean)
MyBase.BooleanValue=Value
EndSet
EndProperty

PublicShadowsPropertyCheckedImageUrl()AsString
Get
ReturnMyBase.CheckedImageUrl
EndGet
Set(ByValValueAsString)
MyBase.CheckedImageUrl=Value
EndSet
EndProperty

PublicOverridesReadOnlyPropertyEditorClientScriptUrl()AsString
Get
Return"checkboxeditor.htc"
EndGet
EndProperty

PublicOverridesReadOnlyPropertyRendererClientScriptUrl()AsString
Get
Return"checkboxrender.htc"
EndGet
EndProperty

PublicShadowsPropertyUncheckedImageUrl()AsString
Get
ReturnMyBase.UncheckedImageUrl
EndGet
Set(ByValValueAsString)
MyBase.UncheckedImageUrl=Value
EndSet
EndProperty

EndClass

PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
DimckboxAsNewmyCheck("img\checked.gif","img\unchecked.gif")
ckbox.BooleanValue=False
FpSpread1.ActiveSheetView.Cells(0,0).CellType=ckbox
FpSpread1.ActiveSheetView.SetCellValue(0,0,1)
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

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