Skip to content

Latest commit

 

History

History
128 lines (95 loc) · 2.78 KB

tablerow.md

File metadata and controls

128 lines (95 loc) · 2.78 KB

TableRow

Represents a row in a table.

Property Type Description
index int Returns the index number of the row within the rows collection of the table. Zero-indexed. Read-only.
values object[][] Represents the raw values of the specified range. The data returned could be of type string, number, or a boolean. Cell that contain an error will return the error string.

Relationships

None

Methods

Method Return Type Description
delete() void Deletes the row from the table.
getRange() Range Returns the range object associated with the entire row.
load(param: object) void Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

API Specification

delete()

Deletes the row from the table.

Syntax

tableRowObject.delete();

Parameters

None

Returns

void

Examples

var tableName = 'Table1';
var ctx = new Excel.RequestContext();
var row = ctx.workbook.tables.getItem(tableName).tableRows.getItemAt(2);
row.delete();
ctx.executeAsync();

Back

getRange()

Returns the range object associated with the entire row.

Syntax

tableRowObject.getRange();

Parameters

None

Returns

Range

Examples

var tableName = 'Table1';
var ctx = new Excel.RequestContext();
var row = ctx.workbook.tables.getItem(tableName).tableRows.getItemAt(0);
var rowRange = row.getRange();
ctx.load(rowRange);
ctx.executeAsync().then(function () {
	Console.log(rowRange.address);
});

Back

load(param: object)

Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

Syntax

object.load(param);

Parameters

Parameter Type Description
param object Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide loadOption object.

Returns

void

Examples

Back

Getter and Setter Examples

var tableName = 'Table1';
var ctx = new Excel.RequestContext();
var row = ctx.workbook.tables.getItem(tableName).tableRows.getItem(0);
ctx.load(row);
ctx.executeAsync().then(function () {
	Console.log(row.index);
});
var ctx = new Excel.RequestContext();
var tables = ctx.workbook.tables;
var newValues = [["New", "Values", "For", "New", "Row"]];
var row = ctx.workbook.tables.getItem(tableName).tableRows.getItemAt(2);
row.values = newValues;
ctx.load(row);
ctx.executeAsync().then(function () {
	Console.log(row.values);
});

Back