Spread ASP.NET 18
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / CurrencyCellType Class / Format Method
Example


In This Topic
    Format Method (CurrencyCellType)
    In This Topic
    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.
    Overload List
    OverloadDescription
    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.  
    Formats the object as a string. (Inherited from FarPoint.Web.Spread.GeneralCellType)
    Example
    The following example subclasses the CurrencyCellType class and creates a currency cell in the first cell of the spreadsheet.
    [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);
    }
    <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
    See Also