var instance = new GC.Spread.Sheets.Worksheet(name); var value; // Type: NameInfo // パラメータ var fnName; //タイプ: string value = instance.getCustomName(fnName);
パラメータ
- fnName
- カスタム名。
戻り値の型
指定したカスタム名の情報。
var instance = new GC.Spread.Sheets.Worksheet(name); var value; // Type: NameInfo // パラメータ var fnName; //タイプ: string value = instance.getCustomName(fnName);
// 次のサンプルコードは、カスタム名と数式を取得します。 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 GC.Spread.Sheets.NameInfo) { // カスタム名を取得します。 var name = cname.getName(); // 式を取得します。 var expression = cname.getExpression(); // 式文字列を取得します。 var expStr = GC.Spread.Sheets.CalcEngine.expressionToFormula(activeSheet, expression, 0, 0); alert("Name:" + name + ";Expression: =" + expStr); } });
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 GC.Spread.Sheets.NameInfo) { //get CustomName var name = cname.getName(); //get Expression var expression = cname.getExpression(); //get Expression String var expStr = GC.Spread.Sheets.CalcEngine.expressionToFormula(activeSheet, expression, 0, 0); alert("Name:" + name + ";Expression: =" + expStr); } });