Excel.Application class

Represents the Excel application that manages the workbook.

[ API set: ExcelApi 1.1 ]

Extends
OfficeExtension.ClientObject

Properties

calculationMode

Returns the calculation mode used in the workbook, as defined by the constants in Excel.CalculationMode. Possible values are: Automatic, where Excel controls recalculation; AutomaticExceptTables, where Excel controls recalculation but ignores changes in tables; Manual, where calculation is done when the user requests it.

[ API set: ExcelApi 1.1 for get, 1.8 for set ]

Methods

calculate(calculationType)

Recalculate all currently opened workbooks in Excel.

[ API set: ExcelApi 1.1 ]

load(option)

Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.

suspendApiCalculationUntilNextSync()

Suspends calculation until the next "context.sync()" is called. Once set, it is the developer's responsibility to re-calc the workbook, to ensure that any dependencies are propagated.

[ API set: ExcelApi 1.6 ]

toJSON()

Property Details

calculationMode

Returns the calculation mode used in the workbook, as defined by the constants in Excel.CalculationMode. Possible values are: Automatic, where Excel controls recalculation; AutomaticExceptTables, where Excel controls recalculation but ignores changes in tables; Manual, where calculation is done when the user requests it.

[ API set: ExcelApi 1.1 for get, 1.8 for set ]

calculationMode: Excel.CalculationMode | "Automatic" | "AutomaticExceptTables" | "Manual";
Property Value
Excel.CalculationMode | "Automatic" | "AutomaticExceptTables" | "Manual"

Method Details

calculate(calculationType)

Recalculate all currently opened workbooks in Excel.

[ API set: ExcelApi 1.1 ]

calculate(calculationType: Excel.CalculationType): void;
Parameters
calculationType
Excel.CalculationType

Specifies the calculation type to use. See Excel.CalculationType for details.

Returns
void

Examples

Excel.run(function (ctx) {
    ctx.workbook.application.calculate('Full');
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

load(option)

Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.

load(option?: string | string[]): Excel.Application;
Parameters
option
string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns
Remarks

In addition to this signature, this method has the following signatures:

load(option?: { select?: string; expand?: string; }): Excel.Application - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.Application - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items.

Examples

Excel.run(function (ctx) {
    var application = ctx.workbook.application;
    application.load('calculationMode');
    return ctx.sync().then(function() {
        console.log(application.calculationMode);
    });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

suspendApiCalculationUntilNextSync()

Suspends calculation until the next "context.sync()" is called. Once set, it is the developer's responsibility to re-calc the workbook, to ensure that any dependencies are propagated.

[ API set: ExcelApi 1.6 ]

suspendApiCalculationUntilNextSync(): void;
Returns
void

toJSON()

toJSON(): Excel.Interfaces.ApplicationData;
Returns