Class TableCell

  • A TableCell represents a single cell within a Google Slides table.

  • It provides methods to access and modify cell properties like content, alignment, fill, and merge state.

  • You can get information about the cell's position, its parent row and column, and the overall table.

  • TableCell allows you to interact with the text content within the cell using the getText() and setContentAlignment() methods.

  • Scripts using TableCell methods require authorization with specific Google Slides scopes.

TableCell

A cell in a table.

Methods

MethodReturn typeBrief description
getColumnIndex() IntegerReturns the 0-based column index of the table cell.
getColumnSpan() IntegerReturns the column span of the table cell.
getContentAlignment() ContentAlignment Returns the ContentAlignment of the text in the table cell.
getFill() Fill Returns the fill of the table cell.
getHeadCell() TableCell Returns the head cell of this table cell.
getMergeState() CellMergeState Returns the merge state of the table cell.
getParentColumn() TableColumn Returns the table column containing the current cell.
getParentRow() TableRow Returns the table row containing the current cell.
getParentTable() Table Returns the table containing the current cell.
getRowIndex() IntegerReturns the 0-based row index of the table cell.
getRowSpan() IntegerReturns the row span of the table cell.
getText() TextRange Returns the text content of the table cell.
setContentAlignment(contentAlignment) TableCell Sets the ContentAlignment of the text in the table cell.

Detailed documentation

getColumnIndex()

Returns the 0-based column index of the table cell.

Return

Integer

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getColumnSpan()

Returns the column span of the table cell.

Return

Integer

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getContentAlignment()

Returns the ContentAlignment of the text in the table cell.

Return

ContentAlignment

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getFill()

Returns the fill of the table cell.

Return

Fill

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getHeadCell()

Returns the head cell of this table cell. Returns null if this cell has not been merged or if this cell is the head cell.

Return

TableCell

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getMergeState()

Returns the merge state of the table cell.

Return

CellMergeState

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParentColumn()

Returns the table column containing the current cell.

Return

TableColumn

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParentRow()

Returns the table row containing the current cell.

Return

TableRow

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParentTable()

Returns the table containing the current cell.

Return

Table

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getRowIndex()

Returns the 0-based row index of the table cell.

Return

Integer

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getRowSpan()

Returns the row span of the table cell.

Return

Integer

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getText()

Returns the text content of the table cell. Returns null if the cell is merged but is not a head cell.

Text within a table cell always terminates with a newline character.

Return

TextRange

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setContentAlignment(contentAlignment)

Sets the ContentAlignment of the text in the table cell.

Parameters

NameTypeDescription
contentAlignmentContentAlignment

Return

TableCell

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年12月02日 UTC.