Excel.JavaScriptCustomFunctionReferenceCellValue interface
JavaScript カスタム関数への参照を表します。
注釈
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-function-references.yaml
// Attach a reference to a JavaScript custom function as a method on a math entity.
await Excel.run(async (context) => {
const sheet: Excel.Worksheet = context.workbook.worksheets.getItem("Sample");
const entityRange: Excel.Range = sheet.getRange("A2");
const referenceType: Excel.FunctionCellValueType = Excel.FunctionCellValueType.javaScriptReference;
const customFunctionReference: Excel.JavaScriptCustomFunctionReferenceCellValue = {
type: Excel.CellValueType.function,
functionType: referenceType,
namespace: "CONTOSO",
id: "GET27"
};
// The namespace and ID identify a function; this value doesn't register its implementation.
const mathEntity: Excel.EntityCellValue = {
type: Excel.CellValueType.entity,
text: "Math value",
properties: {
Value: {
type: Excel.CellValueType.double,
basicValue: 10
},
Get27: customFunctionReference
}
};
entityRange.valuesAsJson = [[mathEntity]];
entityRange.format.autofitColumns();
await context.sync();
console.log("Created the Math value entity in Sample!A2. Read the reference to inspect its metadata.");
});
プロパティ
| basic |
この値を持つセルに対して |
| basic |
この値を持つセルに対して |
| function |
|
| id | カスタム関数の ID を表します。 詳細については、「 カスタム関数の JSON メタデータを自動生成する: ID」を参照してください。 |
| namespace | カスタム関数によって使用される名前空間を表します。 詳細については、「マニフェスト参照: 名前空間」を参照してください。 |
| type | このセル値の型を表します。 |
プロパティの詳細
basicType
この値を持つセルに対して Range.valueTypes によって返される値を表します。
basicType?: RangeValueType.error | "Error";
プロパティ値
error | "Error"
注釈
basicValue
この値を持つセルに対して Range.values によって返される値を表します。
valuesAsJson プロパティを使用してアクセスする場合、この文字列値は en-US ロケールに合わせて調整されます。
valuesAsJsonLocal プロパティを使用してアクセスする場合、この文字列値はユーザーの表示ロケールに合わせて配置されます。
basicValue?: "#VALUE!" | string;
プロパティ値
"#VALUE!" | string
注釈
functionType
FunctionCellValue
の種類を表します。
functionType: FunctionCellValueType.javaScriptReference | "JavaScriptReference";
プロパティ値
javaScriptReference | "JavaScriptReference"