Word.SelectionInsertFormulaOptions interface
Selection.insertFormula メソッドのオプションを表します。
注釈
[ API set: WordApiDesktop 1.4 ]
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/55-selection/insert-formula.yaml
// Inserts a SUM formula with a currency number format at the selection.
// The selection must be in a table cell.
await Word.run(async (context) => {
const options: Word.SelectionInsertFormulaOptions = {
formula: "=SUM(ABOVE)",
numberFormat: "$#,##0.00",
};
context.document.selection.insertFormula(options);
await context.sync();
console.log("Inserted =SUM(ABOVE) with currency format.");
});
プロパティ
| formula | 指定した場合は、 = (数式) フィールド を評価する数式を指定します。
|
| number |
指定した場合は、 |
プロパティの詳細
formula
指定した場合は、 = (数式) フィールド を評価する数式を指定します。
formula プロパティは、選択範囲がセル内にあり、カーソルを含むセルの上または左側に値を含むセルが少なくとも 1 つ存在する場合にのみ省略可能です。 挿入ポイントの上のセルに値が含まれている場合、挿入されたフィールドは {=SUM(ABOVE)}されます。挿入ポイントの左側のセルに値が含まれている場合、挿入されたフィールドは {=SUM(LEFT)}。 挿入ポイントの上のセルとその左側のセルの両方に値が含まれている場合、Microsoft Wordは次の規則を使用して、挿入する関数SUM決定します。
挿入ポイントのすぐ上のセルに値が含まれている場合、Wordは
{=SUM(ABOVE)}を挿入します。挿入ポイントのすぐ上のセルに値が含まれていないが、カーソルの左側にあるセルが含まれている場合、Wordは
{=SUM(LEFT)}を挿入します。挿入ポイントのすぐ上のセルも、その直前のセルにも値が含まれている場合、Wordは
{=SUM(ABOVE)}を挿入します。formulaプロパティを指定せず、カーソルの上と左側のすべてのセルが空の場合、= (Formula)フィールドを使用するとエラーが発生します。
formula?: string;
プロパティ値
string
注釈
numberFormat
指定した場合は、 = (Formula) フィールドの結果の形式を指定します。
numberFormat?: string;
プロパティ値
string