Table — Aspose.Slides FOSS for Java API Reference

The Table class represents a table shape on a slide. It extends GeometryShape and implements ITable.

Package: org.aspose.slides.foss

import org.aspose.slides.foss.*;
public class Table extends GeometryShape implements ITable

Inheritance

GeometryShape -> Table


Properties

PropertyTypeAccessDescription
getRows()IRowCollectionReadCollection of rows.
getColumns()IColumnCollectionReadCollection of columns.
getTableFormat()ITableFormatReadTable formatting properties.
getStylePreset() / setStylePreset(TableStylePreset)TableStylePresetRead/WriteBuilt-in table style.
isFirstRow() / setFirstRow(boolean)booleanRead/WriteWhether the first row has special formatting.
isFirstCol() / setFirstCol(boolean)booleanRead/WriteWhether the first column has special formatting.
isLastRow() / setLastRow(boolean)booleanRead/WriteWhether the last row has special formatting.
isLastCol() / setLastCol(boolean)booleanRead/WriteWhether the last column has special formatting.
isRightToLeft() / setRightToLeft(boolean)booleanRead/WriteRight-to-left table direction.

Usage Examples

Create a Table

import org.aspose.slides.foss.*;

Presentation prs = new Presentation();
ISlide slide = prs.getSlides().get(0);

double[] colWidths = {120, 120, 120};
double[] rowHeights = {40, 40, 40};
ITable table = slide.getShapes().addTable(50, 50, colWidths, rowHeights);

// Access a cell's text frame
ICell cell = table.getRows().get(0).get(0);
cell.getTextFrame().setText("Header");

prs.save("table.pptx", SaveFormat.PPTX);

Style a Table

table.setFirstRow(true);
table.setStylePreset(TableStylePreset.MEDIUM_STYLE_2_ACCENT_1);

See Also