SpreadJS Documentation
ParserContext Constructor
The parser calc source
If set to true, use R1C1 notation.
The base row.
The base column.
The culture option.
Represents a parser context, which is used for the CalcParser processes.
Syntax
var instance = new GcSpread.Sheets.Calc.ParserContext(source, useR1C1, baseRow, baseColumn, option);
function ParserContext( 
   source : CalcSource,
   useR1C1 : boolean,
   baseRow : number,
   baseColumn : number,
   option : Object
) : ParserContext;

Parameters

source
The parser calc source
useR1C1
If set to true, use R1C1 notation.
baseRow
The base row.
baseColumn
The base column.
option
The culture option.
Example
This example gets the custom name and formula.
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(0, 1, 2);
activeSheet.setValue(0, 2, 3);
activeSheet.addCustomName("customName1", "=12", 0, 0);
activeSheet.addCustomName("customName2", "Average(20,45)", 0, 0);
activeSheet.addCustomName("customName3", "=$A$1:$C$1");
activeSheet.setFormula(1, 0, "customName1");
activeSheet.setFormula(1, 1, "customName2");
activeSheet.setFormula(1, 2, "sum(customName3)");
 
$("#button1").click(function () {
    var cname = activeSheet.getCustomName("customName2");
    if (cname instanceof GcSpread.Sheets.NameInfo) {
        //get CustomName
        var name = cname.getName();
        //get Expression
        var expression = cname.getExpression();
        //get Expression String
        var expStr = new GcSpread.Sheets.Calc.Parser().unparse(expression, new GcSpread.Sheets.Calc.ParserContext(true, 0, 0));
        alert("Name:" + name + ";Expression: =" + expStr);
    }
});
See Also

Reference

ParserContext type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.