TableRow Object (JavaScript API for Word)

Word 2016, Word for iPad, Word for Mac, Word Online

Represents a row in a Word document.

Properties

Property Type Description Req. Set
cellCount int Gets the number of cells in the row. Read-only. 1.3
horizontalAlignment string Gets and sets the horizontal alignment of every cell in the row. The value can be 'left', 'centered', 'right', or 'justified'. Possible values are: Unknown Unknown alignment.,Left Alignment to the left.,Centered Alignment to the center.,Right Alignment to the right.,Justified Fully justified alignment. 1.3
isHeader bool Checks whether the row is a header row. Read-only. To set the number of header rows, use HeaderRowCount on the Table object. Read-only. 1.3
preferredHeight float Gets and sets the preferred height of the row in points. 1.3
rowIndex int Gets the index of the row in its parent table. Read-only. 1.3
shadingColor string Gets and sets the shading color. 1.3
values string Gets and sets the text values in the row, as a 2D Javascript array. 1.3
verticalAlignment string Gets and sets the vertical alignment of the cells in the row. The value can be 'top', 'center' or 'bottom'. Possible values are: Mixed, Top, Center, Bottom. 1.3

See property access examples.

Relationships

Relationship Type Description Req. Set
cells TableCellCollection Gets cells. Read-only. 1.3
font Font Gets the font. Use this to get and set font name, size, color, and other properties. Read-only. 1.3
parentTable Table Gets parent table. Read-only. 1.3

Methods

Method Return Type Description Req. Set
clear() void Clears the contents of the row. 1.3
delete() void Deletes the entire row. 1.3
getBorder(borderLocation: string) TableBorder Gets the border style of the cells in the row. 1.3
getCellPadding(cellPaddingLocation: CellPaddingLocation) float? Gets cell padding in points. 1.3
getNext() TableRow Gets the next row. Throws if this row is the last one. 1.3
getNextOrNullObject() TableRow Gets the next row. Returns a null object if this row is the last one. 1.3
insertRows(insertLocation: string, rowCount: number, values: string) TableRowCollection Inserts rows using this row as a template. If values are specified, inserts the values into the new rows. 1.3
load(param: object) void Fills the proxy object created in JavaScript layer with property and object values specified in the parameter. 1.1
search(searchText: string, searchOptions: ParamTypeStrings.SearchOptions) RangeCollection Performs a search with the specified searchOptions on the scope of the row. The search results are a collection of range objects. 1.3
select(selectionMode: string) void Selects the row and navigates the Word UI to it. 1.3
setCellPadding(cellPaddingLocation: CellPaddingLocation, cellPadding: float) void Sets cell padding in points. 1.3

Method Details

clear()

Clears the contents of the row.

Syntax

tableRowObject.clear();

Parameters

None

Returns

void

delete()

Deletes the entire row.

Syntax

tableRowObject.delete();

Parameters

None

Returns

void

getBorder(borderLocation: string)

Gets the border style of the cells in the row.

Syntax

tableRowObject.getBorder(borderLocation);

Parameters

Parameter Type Description
borderLocation string Required. The border location. Possible values are: Top, Left, Bottom, Right, InsideHorizontal, InsideVertical, Inside, Outside, All

Returns

TableBorder

getCellPadding(cellPaddingLocation: CellPaddingLocation)

Gets cell padding in points.

Syntax

tableRowObject.getCellPadding(cellPaddingLocation);

Parameters

Parameter Type Description
cellPaddingLocation CellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'.

Returns

float?

getNext()

Gets the next row. Throws if this row is the last one.

Syntax

tableRowObject.getNext();

Parameters

None

Returns

TableRow

getNextOrNullObject()

Gets the next row. Returns a null object if this row is the last one.

Syntax

tableRowObject.getNextOrNullObject();

Parameters

None

Returns

TableRow

insertRows(insertLocation: string, rowCount: number, values: string)

Inserts rows using this row as a template. If values are specified, inserts the values into the new rows.

Syntax

tableRowObject.insertRows(insertLocation, rowCount, values);

Parameters

Parameter Type Description
insertLocation string Required. Where the new rows should be inserted, relative to the current row. It can be 'Before' or 'After'. Possible values are: Before Add content before the contents of the calling object.,After Add content after the contents of the calling object.,Start Prepend content to the contents of the calling object.,End Append content to the contents of the calling object.,Replace Replace the contents of the current object.
rowCount number Required. Number of rows to add
values string Optional. Optional. Strings to insert in the new rows, specified as a 2D array. The number of cells in each row must not exceed the number of cells in the existing row.

Returns

TableRowCollection

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

search(searchText: string, searchOptions: ParamTypeStrings.SearchOptions)

Performs a search with the specified searchOptions on the scope of the row. The search results are a collection of range objects.

Syntax

tableRowObject.search(searchText, searchOptions);

Parameters

Parameter Type Description
searchText string Required. The search text.
searchOptions ParamTypeStrings.SearchOptions Optional. Optional. Options for the search.

Returns

RangeCollection

select(selectionMode: string)

Selects the row and navigates the Word UI to it.

Syntax

tableRowObject.select(selectionMode);

Parameters

Parameter Type Description
selectionMode string Optional. Optional. The selection mode can be 'Select', 'Start' or 'End'. 'Select' is the default. Possible values are: Select, Start, End

Returns

void

setCellPadding(cellPaddingLocation: CellPaddingLocation, cellPadding: float)

Sets cell padding in points.

Syntax

tableRowObject.setCellPadding(cellPaddingLocation, cellPadding);

Parameters

Parameter Type Description
cellPaddingLocation CellPaddingLocation Required. The cell padding location can be 'Top', 'Left', 'Bottom' or 'Right'.
cellPadding float Required. The cell padding.

Returns

void

div>