Skip to main content

TableRow Class

A table row in a slide table.

Declaration

public class TableRow extends PresentationObject

Remarks

Follow the steps below to create a table and add it to a slide:

  1. Create a Table object:
    • Specify the number of rows and columns.
    • Set table position and size. Values are measured in Document units (1/300 inch).
  2. Add the table to the slide’s shapes.

Use the Table.getThis(row, column) method to access cells.

The TableCell.setTextArea() method specifies cell text.

Note

Cells support only text content.

The following code snippet creates a 3x3 table:

Create a 3x3 Table, DevExpress Presentation API for Java

// Create a presentation.
try(Presentation presentation = new Presentation()) {
    // Gets the first slide.
    Slide slide = presentation.getSlides().getFirst();

    // Create a 3x3 table and define its position and size.
    Table table = new Table(3, 3, 100, 100);
    table.setHasHeaderRow(false);       // Disable the header row style.
    table.setWidth(1600);               // Set the table width.

    // Populate table cells with row/column coordinates.
    for (int rowIndex = 0; rowIndex < table.getRows().size(); rowIndex++) {
        for (int colIndex = 0; colIndex < table.getColumns().size(); colIndex++) {
            table.getThis(rowIndex, colIndex)
                    .getTextArea()
                    .setText(String.format("(%d, %d)", rowIndex, colIndex));
        }
    }

    // Add the table to the slide.
    slide.getShapes().add(table);

    // Your additional implementation goes here.
}

Refer to the following help topic for additional information: Work with Tables — Presentation API for Java.

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object

Constructors

TableRow() Constructor

Initializes a new instance of the TableRow class.

Declaration

public TableRow()

TableRow(float height) Constructor

Initializes a new instance of the TableRow class with specified settings.

Declaration

public TableRow(float height)

Parameters

Name Type Description
height float

The row height.

Methods

deepClone() Method

Clones the current TableRow instance.

Declaration

public TableRow deepClone()

Returns

Type Description
TableRow

The cloned TableRow instance.

getCount() Method

Returns the number of cells in the table row.

Declaration

public int getCount()

Returns

Type Description
int

The number of cells in the table row.

getHeight() Method

Returns the height of the table row in Document units (1 document unit is equal to 1/300 of an inch).

Declaration

public float getHeight()

Returns

Type Description
float

The height of the table row.

getThis(int index) Method

Returns the table cell at the specified index.

Declaration

public TableCell getThis(int index)

Parameters

Name Type Description
index int

The zero-based index.

Returns

Type Description
TableCell

The table cell at the specified index.

setHeight(float value) Method

Sets the height of the table row in Document units (1 document unit is equal to 1/300 of an inch).

Declaration

public void setHeight(float value)

Parameters

Name Type Description
value float

The height of the table row.

setThis(int index, TableCell value) Method

Sets the table cell at the specified index.

Declaration

public void setThis(int index, TableCell value)

Parameters

Name Type Description
index int

The zero-based index.

value TableCell

The table cell.