TableBlockProxy

A block is a single shape on the document. A BlockProxy provides an interface to
read and write the content of an existing block, and is typically accessed through
PageProxy.blocks or another
similar mechanism.

Extends


Constructors

new TableBlockProxy()

new TableBlockProxy(id, client): TableBlockProxy

Parameters

ParameterTypeDescription
idstringID of this item
clientEditorClient

Returns

TableBlockProxy

Inherited from

BlockProxy.constructor


Properties

allShapeData

readonly allShapeData: MapProxy<string, SerializedFieldType | DataError>;

All shape data accessible on this element, including shape data inherited from the page or a containing group.
This collection is read-only.

Inherited from

BlockProxy.allShapeData


client

protected readonly client: EditorClient;

Inherited from

BlockProxy.client


id

readonly id: string;

ID of this item

Inherited from

BlockProxy.id


properties

readonly properties: WriteableMapProxy<string, JsonSerializable, void, JsonSerializable>;

All properties available on this element, organized by name.
Not all properties are writeable (e.g. "ClassName" on a block).
To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

Inherited from

BlockProxy.properties


referenceKeys

readonly referenceKeys: MapProxy<string | number, ReferenceKeyProxy>;

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.

Inherited from

BlockProxy.referenceKeys


shapeData

readonly shapeData: ShapeDataProxy;

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).

Inherited from

BlockProxy.shapeData


textAreas

readonly textAreas: WriteableMapProxy<string, string, undefined, string>;

The plain text in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textAreas


textStyles

readonly textStyles: WriteableMapProxy<string, TextStyle, Promise<undefined>, Partial<TextStyle>>;

The text style in each of the text areas on this item, organized by text area name.

Inherited from

BlockProxy.textStyles


classNameRegex

static classNameRegex: RegExp;

Methods

addColumn()

addColumn(referenceCell, before): TableColumnProxy

Parameters

ParameterTypeDefault valueDescription
referenceCellTableCellProxyundefinedThe cell to add the new column before or after.
beforebooleanfalseIf true, the new column will be added before the reference cell, otherwise it will be added after.

Returns

TableColumnProxy

The TableColumnProxy for the newly added column.


addRow()

addRow(referenceCell, before): TableRowProxy

Parameters

ParameterTypeDefault valueDescription
referenceCellTableCellProxyundefinedThe cell to add the new row before or after.
beforebooleanfalseIf true, the new row will be added before the reference cell, otherwise it will be added after.

Returns

TableRowProxy

The TableRowProxy for the newly added row.


applyRule()

applyRule(rule): void

Parameters

ParameterTypeDescription
ruleRuleProxyRule to apply to this item

Returns

void

Inherited from

BlockProxy.applyRule


changeZOrder()

changeZOrder(operation): void

Parameters

ParameterTypeDescription
operationZOrderOperationHow to adjust the Z order of this item relative to the other items it overlaps on the page

Returns

void

Inherited from

BlockProxy.changeZOrder


delete()

delete(): void

Delete this item from the document

Returns

void

Inherited from

BlockProxy.delete


deleteColumn()

deleteColumn(column): void

Parameters

ParameterTypeDescription
columnnumberThe index of the column to delete.

Returns

void


deleteRow()

deleteRow(row): void

Parameters

ParameterTypeDescription
rownumberThe index of the row to delete.

Returns

void


executeFormula()

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters

ParameterTypeDescription
formulastringThe formula text, e.g. "@a + @b" to add together the shape data values a and b.

Returns

SerializedFieldType | DataError

The result of the formula, or an error.

Inherited from

BlockProxy.executeFormula


exists()

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise

Inherited from

BlockProxy.exists


getAutoResizeColumns()

getAutoResizeColumns(): boolean

Returns

boolean


getAutoResizeRows()

getAutoResizeRows(): boolean

Returns

boolean


getBoundingBox()

getBoundingBox(): Box

Returns

Box

The bounding box of this item relative to its containing page. As pages may change size
to fit the content on them, note that these coordinates may be negative or very large.

If this is a rotated block, the bounding box returned here is where the block would be if it were
unrotated.

Inherited from

BlockProxy.getBoundingBox


getCellByTextAreaKey()

getCellByTextAreaKey(textAreaKey): undefined | TableCellProxy

Parameters

ParameterTypeDescription
textAreaKeystringThe text area key of a cell in the table

Returns

undefined | TableCellProxy

The TableCellProxy represented by the text area key, or undefined if the text area key does not exist in the table.


getClassName()

getClassName(): string

Returns

string

The class name of this block. This name is not necessarily human-readable,
and will remain consistent over time, e.g. "ProcessBlock"..

Inherited from

BlockProxy.getClassName


getColumnCount()

getColumnCount(): number

Returns

number


getColumnWidths()

getColumnWidths(): number[]

Returns

number[]


getConnectedLines()

getConnectedLines(): LineProxy[]

Returns

LineProxy[]

An array of lines that have one or both endpoints connected to this block.

Inherited from

BlockProxy.getConnectedLines


getContainers()

getContainers(): BlockProxy[]

Returns

BlockProxy[]

An array of blocks whose bounding boxes contain this item's upper-left corner

Inherited from

BlockProxy.getContainers


getLineWidth()

getLineWidth(): number

Returns

number

The line width used by most kinds of blocks to render their outline.

Inherited from

BlockProxy.getLineWidth


getLocation()

getLocation(): object

Returns

object

The x/y location of this item

x
x: number = bb.x;
y
y: number = bb.y;

Inherited from

BlockProxy.getLocation


getPage()

getPage(): PageProxy

Returns

PageProxy

The page containing this item

Inherited from

BlockProxy.getPage


getPageId()

getPageId(): string

Returns

string

The ID of the page containing this item

Inherited from

BlockProxy.getPageId


getRotatedBoundingBox()

getRotatedBoundingBox(): Box

Returns

Box

An axis-aligned bounding box containing this full item after any rotation it might have

Inherited from

BlockProxy.getRotatedBoundingBox


getRotation()

getRotation(): number

Returns

number

The amount this block is rotated around its own center, in radians.

Inherited from

BlockProxy.getRotation


getRowCount()

getRowCount(): number

Returns

number


getRowHeights()

getRowHeights(): number[]

Returns

number[]


getRows()

getRows(): TableRowProxy[]

Returns

TableRowProxy[]


getShadow()

getShadow(): undefined | Shadow

Returns

undefined | Shadow

The current drop shadow on this block, or undefined if no shadow is set

Inherited from

BlockProxy.getShadow


getSimpleStaticDataGraphic()

getSimpleStaticDataGraphic(): undefined | SimpleStaticDataGraphicSettings

Returns

undefined | SimpleStaticDataGraphicSettings

Settings for the simple static data graphic currently set on this block, or undefined
if no simple data graphic is currently set. Note that if a data graphic exists that is not an
icon, this will return undefined. This function will not consider data graphics set via
conditional formatting rules.

Inherited from

BlockProxy.getSimpleStaticDataGraphic


linkText()

linkText(
   textAreaKey, 
   referenceKey, 
   field): void

Link a text area to a data field, so that editing the text area will also update the
associated data, and vice versa.

To use this, first establish a reference key on this block with
setReferenceKey.

Parameters

ParameterTypeDescription
textAreaKeystring
referenceKeystring | number
fieldstring

Returns

void

Inherited from

BlockProxy.linkText


lockAspectRatio()

lockAspectRatio(): void

Lock this block's aspect ratio to its current value.
This can be reversed with unlockAspectRatio.

Returns

void

Inherited from

BlockProxy.lockAspectRatio


measureText()

measureText(name, maxWidth): MeasureTextResult

Measure the amount of space necessary to render the text in the given text area, given a
width to measure that text within.

Parameters

ParameterTypeDescription
namestringName of the text area whose content we should measure
maxWidthnumberWidth of the area in which to measure this text. The result will usually be no wider than this, but if a single word is long enough to go beyond this maxWidth, the width of that word will be returned.

Returns

MeasureTextResult

The size of rectangle necessary to render this text area's content.

Inherited from

BlockProxy.measureText


offset()

offset(type, offset): void

Offset this item in the given direction by the given amount.

Parameters

ParameterTypeDescription
typeLinearOffsetTypeThe type of offset to apply to this item
offsetPointThe amount to offset

Returns

void

Inherited from

BlockProxy.offset


removeReferenceKey()

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters

ParameterTypeDescription
keystring | number

Returns

void

Inherited from

BlockProxy.removeReferenceKey


setAutoResizeColumns()

setAutoResizeColumns(auto): void

Parameters

ParameterType
autoboolean

Returns

void


setAutoResizeRows()

setAutoResizeRows(auto): void

Parameters

ParameterType
autoboolean

Returns

void


setBoundingBox()

setBoundingBox(bb): void

Attempts to move and resize this item to fit into the given bounding box. If this item (or another
item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested
location exactly.

This is done by moving this item to the requested location, then attempting to resize it from the
bottom-right corner to the requested size.

Parameters

ParameterTypeDescription
bbBoxThe bounding box to attempt to make this item fill

Returns

void

Inherited from

BlockProxy.setBoundingBox


setColumnWidths()

setColumnWidths(widths): void

Parameters

ParameterType
widthsnumber[]

Returns

void


setDataSyncStateIconPosition()

setDataSyncStateIconPosition(position): void

Parameters

ParameterTypeDescription
positionundefined | BadgeEnumPositionThe postion where the data sync state icon should be displayed on the block. If this position is set to undefined then the state icon position will fallback to the default position for the block.

Returns

void

Inherited from

BlockProxy.setDataSyncStateIconPosition


setFillStyle()

setFillStyle(fillStyle): void

Set the fill style used (by most kinds of blocks) to fill in their main opaque areas.
This can be a string color (e.g. '#ff00ff80') or an image fill.

Parameters

ParameterType
fillStyleSimpleFillStyle

Returns

void

Inherited from

BlockProxy.setFillStyle


setInsetMargin()

setInsetMargin(margin): void

Parameters

ParameterTypeDescription
marginnumberThe inset margin to be used, it control the margin for each table cell.

Returns

void


setLineWidth()

setLineWidth(width): void

Parameters

ParameterTypeDescription
widthnumberThe line width to be used (by most kinds of blocks) to render this block's outline

Returns

void

Inherited from

BlockProxy.setLineWidth


setLocation()

setLocation(location): void

Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)

Parameters

ParameterTypeDescription
locationPointThe target location

Returns

void

Inherited from

BlockProxy.setLocation


setReferenceKey()

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters

ParameterTypeDescription
keystring | number
settingsReferenceKeyDefinition

Returns

void

Inherited from

BlockProxy.setReferenceKey


setRotation()

setRotation(radians): void

Parameters

ParameterTypeDescription
radiansnumberAngle the block should be rotated

Returns

void

Inherited from

BlockProxy.setRotation


setRowHeights()

setRowHeights(heights): void

Parameters

ParameterType
heightsnumber[]

Returns

void


setShadow()

setShadow(shadow): void

Parameters

ParameterTypeDescription
shadowundefined | ShadowThe drop shadow to set on the block, or undefined to clear the drop shadow

Returns

void

Inherited from

BlockProxy.setShadow


setSimpleStaticDataGraphic()

setSimpleStaticDataGraphic(settings): void

Parameters

ParameterTypeDescription
settingsundefined | SimpleStaticDataGraphicSettingsInformation about the static data graphic icon to set on this block.

Returns

void

Inherited from

BlockProxy.setSimpleStaticDataGraphic


unapplyRule()

unapplyRule(rule): void

Parameters

ParameterTypeDescription
ruleRuleProxyRule to remove from this item

Returns

void

Inherited from

BlockProxy.unapplyRule


unlockAspectRatio()

unlockAspectRatio(): void

Unlock the aspect ratio of this block, allowing it to be stretched vertically or horizontally independently.

Returns

void

Inherited from

BlockProxy.unlockAspectRatio