Excel.WorksheetFormulaChangedEventArgs interface
数式変更イベントを発生させたワークシートと数式に関する情報を提供します。
注釈
例
async function registerFormulaChangeHandler() {
await Excel.run(async (context) => {
// Register the formula changed event handler for the Sample worksheet.
let sheet = context.workbook.worksheets.getItem("Sample");
sheet.onFormulaChanged.add(formulaChangeHandler);
await context.sync();
});
}
async function formulaChangeHandler(event: Excel.WorksheetFormulaChangedEventArgs) {
await Excel.run(async (context) => {
// Retrieve details about the formula change event.
const cellAddress = event.formulaDetails[0].cellAddress;
const previousFormula = event.formulaDetails[0].previousFormula;
const source = event.source;
// Print out the change event details.
console.log(
`The formula in cell ${cellAddress} changed.
The previous formula was: ${previousFormula}.
The source of the change was: ${source}.`
);
});
}
プロパティ
| formula |
変更されたすべての数式に関する詳細を含む、 変更された数式の数または変更された数式テキストのサイズがサイズ制限を超えた場合、 |
| source | イベントのソース。 ローカルまたはリモート (共同編集を使用) できます。 |
| type | イベントの種類を取得します。 詳細は「 |
| worksheet |
数式が変更されたワークシートの ID を取得します。 |
プロパティの詳細
formulaDetails
変更されたすべての数式に関する詳細を含む、 FormulaChangedEventDetail オブジェクトの配列を取得します。
変更された数式の数または変更された数式テキストのサイズがサイズ制限を超えた場合、 formulaDetails は未定義を返します。 これは、シート上の何かが変更されたが、詳細を報告できないことを示します。
formulaDetails: Excel.FormulaChangedEventDetail[];
プロパティ値
注釈
source
イベントのソース。 ローカルまたはリモート (共同編集を使用) できます。
source: Excel.EventSource | "Local" | "Remote";
プロパティ値
Excel.EventSource | "Local" | "Remote"
注釈
type
イベントの種類を取得します。 詳細は「Excel.EventType」をご覧ください。
type: "WorksheetFormulaChanged";
プロパティ値
"WorksheetFormulaChanged"