Package org.apache.poi.hslf.usermodel
Class HSLFTable
java.lang.Object
org.apache.poi.hslf.usermodel.HSLFShape
org.apache.poi.hslf.usermodel.HSLFGroupShape
org.apache.poi.hslf.usermodel.HSLFTable
- All Implemented Interfaces:
Iterable<HSLFShape>,HSLFShapeContainer,GroupShape<HSLFShape,,HSLFTextParagraph> PlaceableShape<HSLFShape,,HSLFTextParagraph> Shape<HSLFShape,,HSLFTextParagraph> ShapeContainer<HSLFShape,,HSLFTextParagraph> TableShape<HSLFShape,HSLFTextParagraph>
public final class HSLFTable
extends HSLFGroupShape
implements HSLFShapeContainer, TableShape<HSLFShape,HSLFTextParagraph>
Represents a table in a PowerPoint presentation
- Author:
- Yegor Kozlov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final intprotected static final intprotected HSLFTableCell[][] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHSLFTable(int numRows, int numCols) Create a new Table of the given number of rows and columnsprotectedHSLFTable(int numRows, int numCols, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) Create a new Table of the given number of rows and columnsprotectedHSLFTable(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) Create a Table object and initialize it from the supplied Record container. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterInsert(HSLFSheet sh) Event which fires when a shape is inserted in the sheet.getCell(int row, int col) Gets a celldoublegetColumnWidth(int col) Gets the width (in points) of the n-th columnintReturn the maximum number of columns.intReturn the number of rowsprotected HSLFTableCellgetRelativeCell(HSLFTableCell origin, int row, int col) doublegetRowHeight(int row) Gets the row heightprotected voidprotected voidmoveAndScale(Rectangle2D anchorDest) Moves and scales thisShapeGroupto the specified anchor.voidsetColumnWidth(int col, double width) Sets the width (in points) of the n-th columnvoidsetRowHeight(int row, double height) Sets the row height.voidAssign theSlideShowthis shape belongs toMethods inherited from class org.apache.poi.hslf.usermodel.HSLFGroupShape
addShape, createAutoShape, createConnector, createFreeform, createGroup, createOleShape, createPicture, createSpContainer, createTable, createTextBox, getAnchor, getEscherChild, getHyperlink, getInteriorAnchor, getShapes, getShapeType, iterator, removeShape, setAnchor, setExteriorAnchor, setInteriorAnchorMethods inherited from class org.apache.poi.hslf.usermodel.HSLFShape
draw, getClientData, getClientDataRecord, getClientRecords, getEscherChild, getEscherChild, getEscherChild, getEscherOptRecord, getEscherProperty, getEscherProperty, getEscherProperty, getFill, getFillStyle, getFlipHorizontal, getFlipVertical, getParent, getRotation, getShapeId, getShapeName, getSheet, getSpContainer, isPlaceholder, moveTo, setEscherProperty, setEscherProperty, setFlipHorizontal, setFlipVertical, setRotation, setShapeId, setShapeTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.poi.hslf.usermodel.HSLFShapeContainer
createAutoShape, createConnector, createFreeform, createGroup, createOleShape, createPicture, createTextBoxMethods inherited from interface java.lang.Iterable
forEach, iterator, 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, getSheetMethods inherited from interface org.apache.poi.sl.usermodel.ShapeContainer
addShape, createTable, getShapes, removeShape
-
Field Details
-
BORDERS_ALL
protected static final int BORDERS_ALL- See Also:
-
BORDERS_OUTSIDE
protected static final int BORDERS_OUTSIDE- See Also:
-
BORDERS_INSIDE
protected static final int BORDERS_INSIDE- See Also:
-
BORDERS_NONE
protected static final int BORDERS_NONE- See Also:
-
cells
-
-
Constructor Details
-
HSLFTable
protected HSLFTable(int numRows, int numCols) Create a new Table of the given number of rows and columns- Parameters:
numRows- the number of rowsnumCols- the number of columns
-
HSLFTable
Create a new Table of the given number of rows and columns- Parameters:
numRows- the number of rowsnumCols- the number of columnsparent- the parent shape, or null if table is added to sheet
-
HSLFTable
protected HSLFTable(EscherContainerRecord escherRecord, ShapeContainer<HSLFShape, HSLFTextParagraph> parent) Create a Table object and initialize it from the supplied Record container.- Parameters:
escherRecord-EscherSpContainercontainer which holds information about this shapeparent- the parent of the shape
-
-
Method Details
-
getCell
Description copied from interface:TableShapeGets a cell- Specified by:
getCellin interfaceTableShape<HSLFShape,HSLFTextParagraph> - 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
-
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<HSLFShape,HSLFTextParagraph> - Returns:
- the maximum number of column
-
getNumberOfRows
public int getNumberOfRows()Description copied from interface:TableShapeReturn the number of rows- Specified by:
getNumberOfRowsin interfaceTableShape<HSLFShape,HSLFTextParagraph> - Returns:
- the row count
-
afterInsert
Description copied from class:HSLFShapeEvent which fires when a shape is inserted in the sheet. In some cases we need to propagate changes to upper level containers.
Default implementation does nothing.- Overrides:
afterInsertin classHSLFShape- Parameters:
sh- - owning shape
-
initTable
protected void initTable() -
setSheet
Assign theSlideShowthis shape belongs to -
getRowHeight
public double getRowHeight(int row) Description copied from interface:TableShapeGets the row height- Specified by:
getRowHeightin interfaceTableShape<HSLFShape,HSLFTextParagraph> - 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<HSLFShape,HSLFTextParagraph> - Parameters:
row- the row index (0-based)height- the height to set (in points)
-
getColumnWidth
public double getColumnWidth(int col) Description copied from interface:TableShapeGets the width (in points) of the n-th column- Specified by:
getColumnWidthin interfaceTableShape<HSLFShape,HSLFTextParagraph> - Parameters:
col- the column index (0-based)- Returns:
- the width (in points)
-
setColumnWidth
public void setColumnWidth(int col, double width) Description copied from interface:TableShapeSets the width (in points) of the n-th column- Specified by:
setColumnWidthin interfaceTableShape<HSLFShape,HSLFTextParagraph> - Parameters:
col- the column index (0-based)width- the width (in points)
-
getRelativeCell
-
moveAndScale
Description copied from class:HSLFGroupShapeMoves and scales thisShapeGroupto the specified anchor.- Overrides:
moveAndScalein classHSLFGroupShape
-