Skip to main content

TableColumn Class

A table column in a slide table.

Declaration

public class TableColumn 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
JavaObject

Constructors

TableColumn() Constructor

Initializes a new instance of the TableColumn class.

Declaration

public TableColumn()

TableColumn(float width) Constructor

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

Declaration

public TableColumn(float width)

Parameters

Name Type Description
width float

The column width.

Methods

deepClone() Method

Clones the current TableColumn instance.

Declaration

public TableColumn deepClone()

Returns

Type Description
TableColumn

The cloned TableColumn instance.

getCount() Method

Returns the number of cells in the table column.

Declaration

public int getCount()

Returns

Type Description
int

The number of cells in the table column.

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.

getWidth() Method

Returns the column width in Document units (1 document unit is equal to 1/300 of an inch).

Declaration

public float getWidth()

Returns

Type Description
float

The column width.

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.

setWidth(float value) Method

Sets the column width in Document units (1 document unit is equal to 1/300 of an inch).

Declaration

public void setWidth(float value)

Parameters

Name Type Description
value float

The column width.