SpreadJS Documentation
Format Method
The object with cell data to format.
The conditional foreground color.
Formats the specified object as a string with a conditional color. This function should be overwritten.
Syntax
var instance = new GcSpread.Sheets.CustomFormatterBase(format, cultureName);
var value; // Type: string
value = instance.Format(obj, conditionalForeColor);
function Format( 
   obj : Object,
   conditionalForeColor : Object
) : string;

Parameters

obj
The object with cell data to format.
conditionalForeColor
The conditional foreground color.

Return Value

The formatted string.
Example
This example creates a custom formatter.
var customFormatterTest = {};
customFormatterTest.prototype = GcSpread.Sheets.CustomFormatterBase;
customFormatterTest.Format = function (obj, conditionalForeColor) {
    conditionalForeColor.value = "blue";
    return "My format result : " + obj.toString();
};
customFormatterTest.Parse = function (str) {
    if (!str) {
        return "";
    }
    return str;
}
activeSheet.getCell(1, 0).formatter(customFormatterTest);
activeSheet.getCell(1, 0).value("Test");
See Also

Reference

CustomFormatterBase type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.