Excel.RangeView class

RangeView represents a set of visible cells of the parent range.

Extends

Remarks

[ API set: ExcelApi 1.3 ]

Properties

cellAddresses

Represents the cell addresses of the RangeView.

columnCount

The number of visible columns.

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

formulas

Represents the formula in A1-style notation. If a cell has no formula, its value is returned instead.

formulasLocal

Represents the formula in A1-style notation, in the user's language and number-formatting locale. For example, the English "=SUM(A1, 1.5)" formula would become "=SUMME(A1; 1,5)" in German. If a cell has no formula, its value is returned instead.

formulasR1C1

Represents the formula in R1C1-style notation. If a cell has no formula, its value is returned instead.

index

Returns a value that represents the index of the RangeView.

numberFormat

Represents Excel's number format code for the given cell.

rowCount

The number of visible rows.

rows

Represents a collection of range views associated with the range.

text

Text values of the specified range. The text value will not depend on the cell width. The # sign substitution that happens in Excel UI will not affect the text value returned by the API.

values

Represents the raw values of the specified range view. The data returned could be of type string, number, or a boolean. Cells that contain an error will return the error string.

valueTypes

Represents the type of data of each cell.

Methods

getRange()

Gets the parent range associated with the current RangeView.

load(options)

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

load(propertyNames)

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

load(propertyNamesAndPaths)

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

set(properties, options)

Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties)

Sets multiple properties on the object at the same time, based on an existing loaded object.

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.RangeView object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.RangeViewData) that contains shallow copies of any loaded child properties from the original object.

Property Details

cellAddresses

Represents the cell addresses of the RangeView.

readonly cellAddresses: any[][];

Property Value

any[][]

Remarks

[ API set: ExcelApi 1.3 ]

columnCount

The number of visible columns.

readonly columnCount: number;

Property Value

number

Remarks

[ API set: ExcelApi 1.3 ]

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

context: RequestContext;

Property Value

formulas

Represents the formula in A1-style notation. If a cell has no formula, its value is returned instead.

formulas: any[][];

Property Value

any[][]

Remarks

[ API set: ExcelApi 1.3 ]

formulasLocal

Represents the formula in A1-style notation, in the user's language and number-formatting locale. For example, the English "=SUM(A1, 1.5)" formula would become "=SUMME(A1; 1,5)" in German. If a cell has no formula, its value is returned instead.

formulasLocal: any[][];

Property Value

any[][]

Remarks

[ API set: ExcelApi 1.3 ]

formulasR1C1

Represents the formula in R1C1-style notation. If a cell has no formula, its value is returned instead.

formulasR1C1: any[][];

Property Value

any[][]

Remarks

[ API set: ExcelApi 1.3 ]

index

Returns a value that represents the index of the RangeView.

readonly index: number;

Property Value

number

Remarks

[ API set: ExcelApi 1.3 ]

numberFormat

Represents Excel's number format code for the given cell.

numberFormat: any[][];

Property Value

any[][]

Remarks

[ API set: ExcelApi 1.3 ]

rowCount

The number of visible rows.

readonly rowCount: number;

Property Value

number

Remarks

[ API set: ExcelApi 1.3 ]

rows

Represents a collection of range views associated with the range.

readonly rows: Excel.RangeViewCollection;

Property Value

Remarks

[ API set: ExcelApi 1.3 ]

text

Text values of the specified range. The text value will not depend on the cell width. The # sign substitution that happens in Excel UI will not affect the text value returned by the API.

readonly text: string[][];

Property Value

string[][]

Remarks

[ API set: ExcelApi 1.3 ]

values

Represents the raw values of the specified range view. The data returned could be of type string, number, or a boolean. Cells that contain an error will return the error string.

values: any[][];

Property Value

any[][]

Remarks

[ API set: ExcelApi 1.3 ]

valueTypes

Represents the type of data of each cell.

readonly valueTypes: Excel.RangeValueType[][];

Property Value

Remarks

[ API set: ExcelApi 1.3 ]

Method Details

getRange()

Gets the parent range associated with the current RangeView.

getRange(): Excel.Range;

Returns

Remarks

[ API set: ExcelApi 1.3 ]

load(options)

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

load(options?: Excel.Interfaces.RangeViewLoadOptions): Excel.RangeView;

Parameters

options
Excel.Interfaces.RangeViewLoadOptions

Provides options for which properties of the object to load.

Returns

load(propertyNames)

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

load(propertyNames?: string | string[]): Excel.RangeView;

Parameters

propertyNames

string | string[]

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

Returns

load(propertyNamesAndPaths)

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

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Excel.RangeView;

Parameters

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

Returns

set(properties, options)

Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties: Interfaces.RangeViewUpdateData, options?: OfficeExtension.UpdateOptions): void;

Parameters

properties
Excel.Interfaces.RangeViewUpdateData

A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.

options
OfficeExtension.UpdateOptions

Provides an option to suppress errors if the properties object tries to set any read-only properties.

Returns

void

set(properties)

Sets multiple properties on the object at the same time, based on an existing loaded object.

set(properties: Excel.RangeView): void;

Parameters

properties
Excel.RangeView

Returns

void

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original Excel.RangeView object is an API object, the toJSON method returns a plain JavaScript object (typed as Excel.Interfaces.RangeViewData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Excel.Interfaces.RangeViewData;

Returns