Top Description Fields Constructors Methods
org.apache.poi.hssf.usermodel

public abstract Class HSSFShape

extends Object
implements Shape
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.usermodel.Shape
Known Direct Subclasses
org.apache.poi.hssf.usermodel.HSSFShapeGroup, org.apache.poi.hssf.usermodel.HSSFSimpleShape
Imports
org.apache.poi.ddf.EscherBoolProperty, .EscherChildAnchorRecord, .EscherClientAnchorRecord, .EscherComplexProperty, .EscherContainerRecord, .EscherOptRecord, .EscherProperty, .EscherPropertyTypes, .EscherRGBProperty, .EscherSimpleProperty, .EscherSpRecord, org.apache.poi.hssf.record.CommonObjectDataSubRecord, .ObjRecord, org.apache.poi.ss.usermodel.Shape, org.apache.poi.util.LittleEndian, .LittleEndianConsts, .StringUtil

An abstract shape.

Note

Microsoft Excel seems to sometimes disallow higher y1 than y2 or higher x1 than x2 in the anchor, you might need to reverse them and draw shapes vertically or horizontally flipped via setFlipVertical() or setFlipHorizontally().

Field Summary

Modifier and TypeField and Description
private final EscherContainerRecord
private final ObjRecord
private final EscherOptRecord
private HSSFPatriarch
pack-priv HSSFAnchor
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final boolean
public static final int
public static final int
private HSSFShape

Constructor Summary

AccessConstructor and Description
public
HSSFShape(EscherContainerRecord spContainer, ObjRecord objRecord)

creates shapes from existing file

public
HSSFShape(HSSFShape parent, HSSFAnchor anchor)

Create a new shape with the specified parent and anchor.

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
protected abstract void
afterRemove(HSSFPatriarch patriarch)

remove escher container from the patriarch.escherAggregate remove obj, textObj and note records if it's necessary in case of ShapeGroup remove all contained shapes

protected abstract HSSFShape
public int
countOfAllChildren()

Count of all children and their children's children.

protected abstract ObjRecord
protected abstract EscherContainerRecord
public HSSFAnchor

Returns:

the anchor that is used by this shape.
getAnchor
()

Implements org.apache.poi.ss.usermodel.Shape.getAnchor.

protected EscherContainerRecord
public int
getFillColor()

The color used to fill this shape.

public int

Returns:

One of the constants in LINESTYLE_*
getLineStyle
()

public int
getLineStyleColor()

The color applied to the lines of this shape.

public int

Returns:

returns with width of the line in EMUs. 12700 = 1 pt.
getLineWidth
()

protected ObjRecord
public EscherOptRecord

Returns:

the low-level EscherOptRecord
getOptRecord
()

Return the low-level EscherOptRecord to read/modify not yet wrapped escher properties

public HSSFShape
public HSSFPatriarch
public int

Returns:

the rotation, in degrees, that is applied to a shape.
getRotationDegree
()

pack-priv int

Returns:

global shapeId(from EscherSpRecord)
getShapeId
()

public String

Returns:

the name of this shape
getShapeName
()

Implements org.apache.poi.ss.usermodel.Shape.getShapeName.

public boolean

Returns:

whether this shape is horizontally flipped.
isFlipHorizontal
()

public boolean

Returns:

whether this shape is vertically flipped.
isFlipVertical
()

public boolean
isNoFill()

Implements org.apache.poi.ss.usermodel.Shape.isNoFill.

Whether this shape is not filled with a color

public void
setAnchor(HSSFAnchor
the anchor to use.
anchor
)

Sets a particular anchor.

public void
setFillColor(int fillColor)

The color used to fill this shape.

public void
setFillColor(int red, int green, int blue)

Implements org.apache.poi.ss.usermodel.Shape.setFillColor.

Sets the color used to fill this shape using the solid fill pattern.

public void
setFlipHorizontal(boolean
specifies whether this shape is horizontally flipped.
value
)

public void
setFlipVertical(boolean
specifies whether this shape is vertically flipped.
value
)

public void
setLineStyle(int
One of the constants in LINESTYLE_*
lineStyle
)

Sets the line style.

public void
setLineStyleColor(int lineStyleColor)

The color applied to the lines of this shape.

public void
setLineStyleColor(int red, int green, int blue)

Implements org.apache.poi.ss.usermodel.Shape.setLineStyleColor.

The color applied to the lines of this shape.

public void
setLineWidth(int
width in EMU's. 12700EMU's = 1 pt
lineWidth
)

Sets the width of the line.

public void
setNoFill(boolean
if true then no fill will be applied to the shape element.
noFill
)

Implements org.apache.poi.ss.usermodel.Shape.setNoFill.

Sets whether this shape is filled or transparent.

protected void
protected void
protected void
public void
setRotationDegree(short value)

specifies the rotation, in degrees, that is applied to a shape.

pack-priv void
setShapeId(int
- global shapeId which must be set to EscherSpRecord
shapeId
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_escherContainerback to summary
private final EscherContainerRecord _escherContainer
_objRecordback to summary
private final ObjRecord _objRecord
_optRecordback to summary
private final EscherOptRecord _optRecord
_patriarchback to summary
private HSSFPatriarch _patriarch
anchorback to summary
pack-priv HSSFAnchor anchor
FILL__FILLCOLOR_DEFAULTback to summary
public static final int FILL__FILLCOLOR_DEFAULT
LINESTYLE__COLOR_DEFAULTback to summary
public static final int LINESTYLE__COLOR_DEFAULT
LINESTYLE_DASHDOTDOTSYSback to summary
public static final int LINESTYLE_DASHDOTDOTSYS
LINESTYLE_DASHDOTGELback to summary
public static final int LINESTYLE_DASHDOTGEL
LINESTYLE_DASHDOTSYSback to summary
public static final int LINESTYLE_DASHDOTSYS
LINESTYLE_DASHGELback to summary
public static final int LINESTYLE_DASHGEL
LINESTYLE_DASHSYSback to summary
public static final int LINESTYLE_DASHSYS
LINESTYLE_DEFAULTback to summary
public static final int LINESTYLE_DEFAULT
LINESTYLE_DOTGELback to summary
public static final int LINESTYLE_DOTGEL
LINESTYLE_DOTSYSback to summary
public static final int LINESTYLE_DOTSYS
LINESTYLE_LONGDASHDOTDOTGELback to summary
public static final int LINESTYLE_LONGDASHDOTDOTGEL
LINESTYLE_LONGDASHDOTGELback to summary
public static final int LINESTYLE_LONGDASHDOTGEL
LINESTYLE_LONGDASHGELback to summary
public static final int LINESTYLE_LONGDASHGEL
LINESTYLE_NONEback to summary
public static final int LINESTYLE_NONE
LINESTYLE_SOLIDback to summary
public static final int LINESTYLE_SOLID
LINEWIDTH_DEFAULTback to summary
public static final int LINEWIDTH_DEFAULT
LINEWIDTH_ONE_PTback to summary
public static final int LINEWIDTH_ONE_PT
NO_FILL_DEFAULTback to summary
public static final boolean NO_FILL_DEFAULT
NO_FILLHITTEST_FALSEback to summary
public static final int NO_FILLHITTEST_FALSE
NO_FILLHITTEST_TRUEback to summary
public static final int NO_FILLHITTEST_TRUE
parentback to summary
private HSSFShape parent

Constructor Detail

HSSFShapeback to summary
public HSSFShape(EscherContainerRecord spContainer, ObjRecord objRecord)

creates shapes from existing file

HSSFShapeback to summary
public HSSFShape(HSSFShape parent, HSSFAnchor anchor)

Create a new shape with the specified parent and anchor.

Method Detail

afterInsertback to summary
pack-priv abstract void afterInsert(HSSFPatriarch patriarch)
afterRemoveback to summary
protected abstract void afterRemove(HSSFPatriarch patriarch)

remove escher container from the patriarch.escherAggregate remove obj, textObj and note records if it's necessary in case of ShapeGroup remove all contained shapes

cloneShapeback to summary
protected abstract HSSFShape cloneShape()
countOfAllChildrenback to summary
public int countOfAllChildren()

Count of all children and their children's children.

createObjRecordback to summary
protected abstract ObjRecord createObjRecord()
createSpContainerback to summary
protected abstract EscherContainerRecord createSpContainer()
getAnchorback to summary
public HSSFAnchor getAnchor()

Implements org.apache.poi.ss.usermodel.Shape.getAnchor.

Returns:HSSFAnchor

the anchor that is used by this shape.

Annotations
@Override
getEscherContainerback to summary
protected EscherContainerRecord getEscherContainer()
getFillColorback to summary
public int getFillColor()

The color used to fill this shape.

getLineStyleback to summary
public int getLineStyle()
Returns:int

One of the constants in LINESTYLE_*

getLineStyleColorback to summary
public int getLineStyleColor()

The color applied to the lines of this shape.

getLineWidthback to summary
public int getLineWidth()
Returns:int

returns with width of the line in EMUs. 12700 = 1 pt.

getObjRecordback to summary
protected ObjRecord getObjRecord()
getOptRecordback to summary
public EscherOptRecord getOptRecord()

Return the low-level EscherOptRecord to read/modify not yet wrapped escher properties

Returns:EscherOptRecord

the low-level EscherOptRecord

getParentback to summary
public HSSFShape getParent()

Implements org.apache.poi.ss.usermodel.Shape.getParent.

Returns:HSSFShape

Doc from org.apache.poi.ss.usermodel.Shape.getParent.

the parent shape.

Annotations
@Override
getPatriarchback to summary
public HSSFPatriarch getPatriarch()
getRotationDegreeback to summary
public int getRotationDegree()
Returns:int

the rotation, in degrees, that is applied to a shape.

getShapeIdback to summary
pack-priv int getShapeId()
Returns:int

global shapeId(from EscherSpRecord)

getShapeNameback to summary
public String getShapeName()

Implements org.apache.poi.ss.usermodel.Shape.getShapeName.

Returns:String

the name of this shape

Annotations
@Override
isFlipHorizontalback to summary
public boolean isFlipHorizontal()
Returns:boolean

whether this shape is horizontally flipped.

isFlipVerticalback to summary
public boolean isFlipVertical()
Returns:boolean

whether this shape is vertically flipped.

isNoFillback to summary
public boolean isNoFill()

Implements org.apache.poi.ss.usermodel.Shape.isNoFill.

Doc from org.apache.poi.ss.usermodel.Shape.isNoFill.

Whether this shape is not filled with a color

Returns:boolean

true if this shape is not filled with a color.

Annotations
@Override
setAnchorback to summary
public void setAnchor(HSSFAnchor anchor)

Sets a particular anchor. A top-level shape must have an anchor of HSSFClientAnchor. A child anchor must have an anchor of HSSFChildAnchor

Parameters
anchor:HSSFAnchor

the anchor to use.

Exceptions
IllegalArgumentException:
when the wrong anchor is used for this particular shape.
See Also
HSSFChildAnchor, HSSFClientAnchor
setFillColorback to summary
public void setFillColor(int fillColor)

The color used to fill this shape.

setFillColorback to summary
public void setFillColor(int red, int green, int blue)

Implements org.apache.poi.ss.usermodel.Shape.setFillColor.

Doc from org.apache.poi.ss.usermodel.Shape.setFillColor.

Sets the color used to fill this shape using the solid fill pattern.

Annotations
@Override
setFlipHorizontalback to summary
public void setFlipHorizontal(boolean value)
Parameters
value:boolean

specifies whether this shape is horizontally flipped.

setFlipVerticalback to summary
public void setFlipVertical(boolean value)
Parameters
value:boolean

specifies whether this shape is vertically flipped.

setLineStyleback to summary
public void setLineStyle(int lineStyle)

Sets the line style.

Parameters
lineStyle:int

One of the constants in LINESTYLE_*

setLineStyleColorback to summary
public void setLineStyleColor(int lineStyleColor)

The color applied to the lines of this shape.

setLineStyleColorback to summary
public void setLineStyleColor(int red, int green, int blue)

Implements org.apache.poi.ss.usermodel.Shape.setLineStyleColor.

Doc from org.apache.poi.ss.usermodel.Shape.setLineStyleColor.

The color applied to the lines of this shape.

Annotations
@Override
setLineWidthback to summary
public void setLineWidth(int lineWidth)

Sets the width of the line. 12700 = 1 pt.

Parameters
lineWidth:int

width in EMU's. 12700EMU's = 1 pt

See Also
HSSFShape#LINEWIDTH_ONE_PT
setNoFillback to summary
public void setNoFill(boolean noFill)

Implements org.apache.poi.ss.usermodel.Shape.setNoFill.

Doc from org.apache.poi.ss.usermodel.Shape.setNoFill.

Sets whether this shape is filled or transparent.

Parameters
noFill:boolean

if true then no fill will be applied to the shape element.

Annotations
@Override
setParentback to summary
protected void setParent(HSSFShape parent)
setPatriarchback to summary
protected void setPatriarch(HSSFPatriarch _patriarch)
setPropertyValueback to summary
protected void setPropertyValue(EscherProperty property)
setRotationDegreeback to summary
public void setRotationDegree(short value)

specifies the rotation, in degrees, that is applied to a shape. Positive values specify rotation in the clockwise direction. Negative values specify rotation in the counterclockwise direction. Rotation occurs around the center of the shape. The default value for this property is 0x00000000

setShapeIdback to summary
pack-priv void setShapeId(int shapeId)
Parameters
shapeId:int

- global shapeId which must be set to EscherSpRecord