Package org.apache.poi.hssf.usermodel
Class HSSFShape
java.lang.Object
org.apache.poi.hssf.usermodel.HSSFShape
- All Implemented Interfaces:
Shape
- Direct Known Subclasses:
HSSFShapeGroup,HSSFSimpleShape
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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final booleanstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionHSSFShape(EscherContainerRecord spContainer, ObjRecord objRecord) creates shapes from existing fileHSSFShape(HSSFShape parent, HSSFAnchor anchor) Create a new shape with the specified parent and anchor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidafterRemove(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 shapesprotected abstract HSSFShapeintCount of all children and their children's children.protected abstract ObjRecordprotected abstract EscherContainerRecordprotected EscherContainerRecordintThe color used to fill this shape.intintThe color applied to the lines of this shape.intprotected ObjRecordReturn the low-level EscherOptRecord to read/modify not yet wrapped escher propertiesintbooleanbooleanbooleanisNoFill()Whether this shape is not filled with a colorvoidsetAnchor(HSSFAnchor anchor) Sets a particular anchor.voidsetFillColor(int fillColor) The color used to fill this shape.voidsetFillColor(int red, int green, int blue) Sets the color used to fill this shape using the solid fill pattern.voidsetFlipHorizontal(boolean value) voidsetFlipVertical(boolean value) voidsetLineStyle(int lineStyle) Sets the line style.voidsetLineStyleColor(int lineStyleColor) The color applied to the lines of this shape.voidsetLineStyleColor(int red, int green, int blue) The color applied to the lines of this shape.voidsetLineWidth(int lineWidth) Sets the width of the line.voidsetNoFill(boolean noFill) Sets whether this shape is filled or transparent.protected voidprotected voidsetPatriarch(HSSFPatriarch _patriarch) protected voidsetPropertyValue(EscherProperty property) voidsetRotationDegree(short value) specifies the rotation, in degrees, that is applied to a shape.
-
Field Details
-
LINEWIDTH_ONE_PT
public static final int LINEWIDTH_ONE_PT- See Also:
-
LINEWIDTH_DEFAULT
public static final int LINEWIDTH_DEFAULT- See Also:
-
LINESTYLE__COLOR_DEFAULT
public static final int LINESTYLE__COLOR_DEFAULT- See Also:
-
FILL__FILLCOLOR_DEFAULT
public static final int FILL__FILLCOLOR_DEFAULT- See Also:
-
NO_FILL_DEFAULT
public static final boolean NO_FILL_DEFAULT- See Also:
-
LINESTYLE_SOLID
public static final int LINESTYLE_SOLID- See Also:
-
LINESTYLE_DASHSYS
public static final int LINESTYLE_DASHSYS- See Also:
-
LINESTYLE_DOTSYS
public static final int LINESTYLE_DOTSYS- See Also:
-
LINESTYLE_DASHDOTSYS
public static final int LINESTYLE_DASHDOTSYS- See Also:
-
LINESTYLE_DASHDOTDOTSYS
public static final int LINESTYLE_DASHDOTDOTSYS- See Also:
-
LINESTYLE_DOTGEL
public static final int LINESTYLE_DOTGEL- See Also:
-
LINESTYLE_DASHGEL
public static final int LINESTYLE_DASHGEL- See Also:
-
LINESTYLE_LONGDASHGEL
public static final int LINESTYLE_LONGDASHGEL- See Also:
-
LINESTYLE_DASHDOTGEL
public static final int LINESTYLE_DASHDOTGEL- See Also:
-
LINESTYLE_LONGDASHDOTGEL
public static final int LINESTYLE_LONGDASHDOTGEL- See Also:
-
LINESTYLE_LONGDASHDOTDOTGEL
public static final int LINESTYLE_LONGDASHDOTDOTGEL- See Also:
-
LINESTYLE_NONE
public static final int LINESTYLE_NONE- See Also:
-
LINESTYLE_DEFAULT
public static final int LINESTYLE_DEFAULT- See Also:
-
NO_FILLHITTEST_TRUE
public static final int NO_FILLHITTEST_TRUE- See Also:
-
NO_FILLHITTEST_FALSE
public static final int NO_FILLHITTEST_FALSE- See Also:
-
-
Constructor Details
-
HSSFShape
creates shapes from existing file- Parameters:
spContainer-objRecord-
-
HSSFShape
Create a new shape with the specified parent and anchor.
-
-
Method Details
-
createSpContainer
-
createObjRecord
-
afterRemove
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- Parameters:
patriarch-
-
getEscherContainer
-
getObjRecord
-
getOptRecord
Return the low-level EscherOptRecord to read/modify not yet wrapped escher properties- Returns:
- the low-level EscherOptRecord
-
getParent
-
getAnchor
-
setAnchor
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- the anchor to use.- Throws:
IllegalArgumentException- when the wrong anchor is used for this particular shape.- See Also:
-
getLineStyleColor
public int getLineStyleColor()The color applied to the lines of this shape. -
setLineStyleColor
public void setLineStyleColor(int lineStyleColor) The color applied to the lines of this shape. -
setLineStyleColor
public void setLineStyleColor(int red, int green, int blue) Description copied from interface:ShapeThe color applied to the lines of this shape.- Specified by:
setLineStyleColorin interfaceShape
-
getFillColor
public int getFillColor()The color used to fill this shape. -
setFillColor
public void setFillColor(int fillColor) The color used to fill this shape. -
setFillColor
public void setFillColor(int red, int green, int blue) Description copied from interface:ShapeSets the color used to fill this shape using the solid fill pattern.- Specified by:
setFillColorin interfaceShape
-
getLineWidth
public int getLineWidth()- Returns:
- returns with width of the line in EMUs. 12700 = 1 pt.
-
setLineWidth
public void setLineWidth(int lineWidth) Sets the width of the line. 12700 = 1 pt.- Parameters:
lineWidth- width in EMU's. 12700EMU's = 1 pt- See Also:
-
getLineStyle
public int getLineStyle()- Returns:
- One of the constants in LINESTYLE_*
-
setLineStyle
public void setLineStyle(int lineStyle) Sets the line style.- Parameters:
lineStyle- One of the constants in LINESTYLE_*
-
isNoFill
public boolean isNoFill()Description copied from interface:ShapeWhether this shape is not filled with a color -
setNoFill
public void setNoFill(boolean noFill) Description copied from interface:ShapeSets whether this shape is filled or transparent. -
setPropertyValue
-
setFlipVertical
public void setFlipVertical(boolean value) - Parameters:
value- specifies whether this shape is vertically flipped.
-
setFlipHorizontal
public void setFlipHorizontal(boolean value) - Parameters:
value- specifies whether this shape is horizontally flipped.
-
isFlipVertical
public boolean isFlipVertical()- Returns:
- whether this shape is vertically flipped.
-
isFlipHorizontal
public boolean isFlipHorizontal()- Returns:
- whether this shape is horizontally flipped.
-
getRotationDegree
public int getRotationDegree()- Returns:
- the rotation, in degrees, that is applied to a shape.
-
setRotationDegree
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- Parameters:
value-
-
countOfAllChildren
public int countOfAllChildren()Count of all children and their children's children. -
cloneShape
-
setPatriarch
-
getPatriarch
-
setParent
-
getShapeName
- Specified by:
getShapeNamein interfaceShape- Returns:
- the name of this shape
-