SpreadJS 13
GC.Spread.Sheets.CellTypes Namespace / Base class / format Method
The object value to format.
The format.
the formatted data.
The formatted data array, each item is an object that has two properties type and value, And it may contain these types: 'number', 'text', 'fillingChar', 'placeholder', 'exponent', 'decimalSeparator', 'groupSeparator', 'numberPlaceholder', 'percent', 'permille' and 'currency'. For example: {type: 'number', value: '123'}.
The conditional foreground color.
The context associated with the cell type. See the Remarks for more information.
In This Topic
    format Method
    In This Topic
    Formats a value with the specified format to a string.
    Syntax
    var instance = new GC.Spread.Sheets.CellTypes.Base();
    var returnValue; // Type: string
    returnValue = instance.format(value,
                                  format,
                                  formattedData,
                                  formattedData.content,
                                  formattedData.conditionalForeColor,
                                  context);
    function format( 
       value : Object,
       format : undefined,
       formattedData : Object,
       (optional) formattedData.content : Array,
       (optional) formattedData.conditionalForeColor : string,
       context : Object
    ) : string;

    Parameters

    value
    The object value to format.
    format
    The format.
    formattedData
    the formatted data.
    formattedData.content
    The formatted data array, each item is an object that has two properties type and value, And it may contain these types: 'number', 'text', 'fillingChar', 'placeholder', 'exponent', 'decimalSeparator', 'groupSeparator', 'numberPlaceholder', 'percent', 'permille' and 'currency'. For example: {type: 'number', value: '123'}.
    formattedData.conditionalForeColor
    The conditional foreground color.
    context
    The context associated with the cell type. See the Remarks for more information.

    Return Value

    Returns the formatted string.
    Remarks

    The context parameter can include the following items:

    Item Type Description
    context.sheet GC.Spread.Sheets.Sheet instance Indicates the current sheet.
    context.row number The row index.
    context.col number The column index.
    context.sheetArea GC.Spread.Sheets.SheetArea The current sheet area.

     

    See Also

    Reference

    Base class