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 ITableInheritance
GeometryShape -> Table
Properties
| Property | Type | Access | Description |
|---|---|---|---|
getRows() | IRowCollection | Read | Collection of rows. |
getColumns() | IColumnCollection | Read | Collection of columns. |
getTableFormat() | ITableFormat | Read | Table formatting properties. |
getStylePreset() / setStylePreset(TableStylePreset) | TableStylePreset | Read/Write | Built-in table style. |
isFirstRow() / setFirstRow(boolean) | boolean | Read/Write | Whether the first row has special formatting. |
isFirstCol() / setFirstCol(boolean) | boolean | Read/Write | Whether the first column has special formatting. |
isLastRow() / setLastRow(boolean) | boolean | Read/Write | Whether the last row has special formatting. |
isLastCol() / setLastCol(boolean) | boolean | Read/Write | Whether the last column has special formatting. |
isRightToLeft() / setRightToLeft(boolean) | boolean | Read/Write | Right-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);