Package org.apache.poi.xslf.usermodel
Class XSLFTable
java.lang.Object
org.apache.poi.xslf.usermodel.XSLFShape
org.apache.poi.xslf.usermodel.XSLFGraphicFrame
org.apache.poi.xslf.usermodel.XSLFTable
- All Implemented Interfaces:
Iterable<XSLFTableRow>,GraphicalFrame<XSLFShape,,XSLFTextParagraph> PlaceableShape<XSLFShape,,XSLFTextParagraph> Shape<XSLFShape,,XSLFTextParagraph> TableShape<XSLFShape,XSLFTextParagraph>
public class XSLFTable
extends XSLFGraphicFrame
implements Iterable<XSLFTableRow>, TableShape<XSLFShape,XSLFTextParagraph>
Represents a table in a .pptx presentation
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.poi.xslf.usermodel.XSLFShape
XSLFShape.ReparseFactory<T extends XmlObject> -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new column at the end of the table.addRow()getCell(int row, int col) Gets a celldoublegetColumnWidth(int idx) Gets the width (in points) of the n-th columnintReturn the maximum number of columns.intReturn the number of rowsdoublegetRowHeight(int row) Gets the row heightgetRows()voidinsertColumn(int colIdx) Insert a new column at the given index.insertRow(int rowIdx) Insert a new row at the given index.iterator()voidmergeCells(int firstRow, int lastRow, int firstCol, int lastCol) Merge cells of a tablevoidremoveColumn(int colIdx) Remove the column at the given index.voidremoveRow(int rowIdx) Remove the row on the given indexvoidsetColumnWidth(int idx, double width) Sets the width (in points) of the n-th columnvoidsetRowHeight(int row, double height) Sets the row height.voidCalculates the bounding boxes of all cells and updates the dimension of the tableMethods inherited from class org.apache.poi.xslf.usermodel.XSLFGraphicFrame
getAnchor, getChart, getFallbackPicture, getFlipHorizontal, getFlipVertical, getRotation, getShapeType, hasChart, hasDiagram, setAnchor, setFlipHorizontal, setFlipVertical, setRotationMethods inherited from class org.apache.poi.xslf.usermodel.XSLFShape
draw, fetchShapeProperty, getParent, getPlaceholder, getPlaceholderDetails, getShapeId, getShapeName, getSheet, getXmlObject, isPlaceholder, setParent, setPlaceholderMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getAnchor, getFlipHorizontal, getFlipVertical, getParent, getRotation, getSheet, setAnchor, setFlipHorizontal, setFlipVertical, setRotationMethods inherited from interface org.apache.poi.sl.usermodel.Shape
draw, getAnchor, getParent, getShapeId, getShapeName, getSheet
-
Method Details
-
getCell
Description copied from interface:TableShapeGets a cell- Specified by:
getCellin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Parameters:
row- the row index (0-based)col- the column index (0-based)- Returns:
- the cell or null if the cell doesn't exists, e.g. when accessing a merged cell or if the index is out of bounds
-
getCTTable
-
getNumberOfColumns
public int getNumberOfColumns()Description copied from interface:TableShapeReturn the maximum number of columns. If the table contains merged cells, the number of columns might be less than the maximum.- Specified by:
getNumberOfColumnsin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Returns:
- the maximum number of column
-
getNumberOfRows
public int getNumberOfRows()Description copied from interface:TableShapeReturn the number of rows- Specified by:
getNumberOfRowsin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Returns:
- the row count
-
getColumnWidth
public double getColumnWidth(int idx) Description copied from interface:TableShapeGets the width (in points) of the n-th column- Specified by:
getColumnWidthin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Parameters:
idx- the column index (0-based)- Returns:
- the width (in points)
-
setColumnWidth
public void setColumnWidth(int idx, double width) Description copied from interface:TableShapeSets the width (in points) of the n-th column- Specified by:
setColumnWidthin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Parameters:
idx- the column index (0-based)width- the width (in points)
-
getRowHeight
public double getRowHeight(int row) Description copied from interface:TableShapeGets the row height- Specified by:
getRowHeightin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Parameters:
row- the row index (0-based)- Returns:
- the height (in points)
-
setRowHeight
public void setRowHeight(int row, double height) Description copied from interface:TableShapeSets the row height.- Specified by:
setRowHeightin interfaceTableShape<XSLFShape,XSLFTextParagraph> - Parameters:
row- the row index (0-based)height- the height to set (in points)
-
iterator
- Specified by:
iteratorin interfaceIterable<XSLFTableRow>
-
getRows
-
addRow
-
insertRow
Insert a new row at the given index.- Parameters:
rowIdx- the row index.- Since:
- POI 5.0.0
-
removeRow
public void removeRow(int rowIdx) Remove the row on the given index- Parameters:
rowIdx- the row index
-
addColumn
public void addColumn()Add a new column at the end of the table.- Since:
- POI 4.1.2
-
insertColumn
public void insertColumn(int colIdx) Insert a new column at the given index.- Parameters:
colIdx- the column index.- Since:
- POI 4.1.2
-
removeColumn
public void removeColumn(int colIdx) Remove the column at the given index.- Parameters:
colIdx- the column index.- Since:
- POI 4.1.2
-
mergeCells
public void mergeCells(int firstRow, int lastRow, int firstCol, int lastCol) Merge cells of a table -
updateCellAnchor
public void updateCellAnchor()Calculates the bounding boxes of all cells and updates the dimension of the table
-