Package org.apache.poi.hssf.usermodel
Class HSSFPicture
- java.lang.Object
-
- org.apache.poi.hssf.usermodel.HSSFShape
-
- org.apache.poi.hssf.usermodel.HSSFSimpleShape
-
- org.apache.poi.hssf.usermodel.HSSFPicture
-
- All Implemented Interfaces:
Picture,Shape,SimpleShape
- Direct Known Subclasses:
HSSFObjectData
public class HSSFPicture extends HSSFSimpleShape implements Picture
Represents an escher picture. Eg. A GIF, JPEG etc...
-
-
Field Summary
-
Fields inherited from class org.apache.poi.hssf.usermodel.HSSFSimpleShape
OBJECT_TYPE_ARC, OBJECT_TYPE_COMBO_BOX, OBJECT_TYPE_COMMENT, OBJECT_TYPE_LINE, OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING, OBJECT_TYPE_OVAL, OBJECT_TYPE_PICTURE, OBJECT_TYPE_RECTANGLE, WRAP_BY_POINTS, WRAP_NONE, WRAP_SQUARE
-
Fields inherited from class org.apache.poi.hssf.usermodel.HSSFShape
FILL__FILLCOLOR_DEFAULT, LINESTYLE__COLOR_DEFAULT, LINESTYLE_DASHDOTDOTSYS, LINESTYLE_DASHDOTGEL, LINESTYLE_DASHDOTSYS, LINESTYLE_DASHGEL, LINESTYLE_DASHSYS, LINESTYLE_DEFAULT, LINESTYLE_DOTGEL, LINESTYLE_DOTSYS, LINESTYLE_LONGDASHDOTDOTGEL, LINESTYLE_LONGDASHDOTGEL, LINESTYLE_LONGDASHGEL, LINESTYLE_NONE, LINESTYLE_SOLID, LINEWIDTH_DEFAULT, LINEWIDTH_ONE_PT, NO_FILL_DEFAULT, NO_FILLHITTEST_FALSE, NO_FILLHITTEST_TRUE
-
-
Constructor Summary
Constructors Constructor Description HSSFPicture(EscherContainerRecord spContainer, ObjRecord objRecord)HSSFPicture(HSSFShape parent, HSSFAnchor anchor)Constructs a picture object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HSSFShapecloneShape()protected EscherContainerRecordcreateSpContainer()HSSFClientAnchorgetClientAnchor()StringgetFileName()The filename of the embedded imageDimensiongetImageDimension()Return the dimension of the embedded image in pixelHSSFPictureDatagetPictureData()Return picture data for this shapeintgetPictureIndex()HSSFClientAnchorgetPreferredSize()Calculate the preferred size for this picture.HSSFClientAnchorgetPreferredSize(double scale)Calculate the preferred size for this picture.HSSFClientAnchorgetPreferredSize(double scaleX, double scaleY)Calculate the preferred size for this picture.HSSFSheetgetSheet()voidresize()Reset the image to the dimension of the embedded imagevoidresize(double scale)Resize the image proportionally.voidresize(double scaleX, double scaleY)Resize the imagevoidsetFileName(String data)voidsetPictureIndex(int pictureIndex)voidsetShapeType(int shapeType)-
Methods inherited from class org.apache.poi.hssf.usermodel.HSSFSimpleShape
afterRemove, createObjRecord, createTextObjRecord, getShapeId, getShapeType, getString, getTextObjectRecord, getWrapText, setString, setWrapText
-
Methods inherited from class org.apache.poi.hssf.usermodel.HSSFShape
countOfAllChildren, getAnchor, getEscherContainer, getFillColor, getLineStyle, getLineStyleColor, getLineWidth, getObjRecord, getOptRecord, getParent, getPatriarch, getRotationDegree, getShapeName, isFlipHorizontal, isFlipVertical, isNoFill, setAnchor, setFillColor, setFillColor, setFlipHorizontal, setFlipVertical, setLineStyle, setLineStyleColor, setLineStyleColor, setLineWidth, setNoFill, setParent, setPatriarch, setPropertyValue, setRotationDegree
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.ss.usermodel.Shape
getAnchor, getParent, getShapeName, isNoFill, setFillColor, setLineStyleColor, setNoFill
-
-
-
-
Constructor Detail
-
HSSFPicture
public HSSFPicture(EscherContainerRecord spContainer, ObjRecord objRecord)
-
HSSFPicture
public HSSFPicture(HSSFShape parent, HSSFAnchor anchor)
Constructs a picture object.
-
-
Method Detail
-
getPictureIndex
public int getPictureIndex()
-
setPictureIndex
public void setPictureIndex(int pictureIndex)
-
createSpContainer
protected EscherContainerRecord createSpContainer()
- Overrides:
createSpContainerin classHSSFSimpleShape
-
resize
public void resize()
Reset the image to the dimension of the embedded imagePlease note, that this method works correctly only for workbooks with default font size (Arial 10pt for .xls). If the default font is changed the resized image can be stretched vertically or horizontally.
- Specified by:
resizein interfacePicture- See Also:
Picture.resize(double, double)
-
resize
public void resize(double scale)
Resize the image proportionally.- Specified by:
resizein interfacePicture- See Also:
resize(double, double)
-
resize
public void resize(double scaleX, double scaleY)Resize the imagePlease note, that this method works correctly only for workbooks with default font size (Arial 10pt for .xls). If the default font is changed the resized image can be stretched vertically or horizontally.
resize(1.0,1.0)keeps the original size,
resize(0.5,0.5)resize to 50% of the original,
resize(2.0,2.0)resizes to 200% of the original.
resize(resizes to the dimension of the embedded image.Double.MAX_VALUE,Double.MAX_VALUE)
-
getPreferredSize
public HSSFClientAnchor getPreferredSize()
Calculate the preferred size for this picture.- Specified by:
getPreferredSizein interfacePicture- Returns:
- HSSFClientAnchor with the preferred size for this image
- Since:
- POI 3.0.2
-
getPreferredSize
public HSSFClientAnchor getPreferredSize(double scale)
Calculate the preferred size for this picture.- Parameters:
scale- the amount by which image dimensions are multiplied relative to the original size.- Returns:
- HSSFClientAnchor with the preferred size for this image
- Since:
- POI 3.0.2
-
getPreferredSize
public HSSFClientAnchor getPreferredSize(double scaleX, double scaleY)
Calculate the preferred size for this picture.- Specified by:
getPreferredSizein interfacePicture- Parameters:
scaleX- the amount by which image width is multiplied relative to the original width.scaleY- the amount by which image height is multiplied relative to the original height.- Returns:
- HSSFClientAnchor with the preferred size for this image
- Since:
- POI 3.11
-
getImageDimension
public Dimension getImageDimension()
Return the dimension of the embedded image in pixel- Specified by:
getImageDimensionin interfacePicture- Returns:
- image dimension in pixels
-
getPictureData
public HSSFPictureData getPictureData()
Return picture data for this shape- Specified by:
getPictureDatain interfacePicture- Returns:
- picture data for this shape or
nullif picture wasn't embedded, i.e. external linked
-
getFileName
public String getFileName()
The filename of the embedded image
-
setFileName
public void setFileName(String data)
-
setShapeType
public void setShapeType(int shapeType)
- Overrides:
setShapeTypein classHSSFSimpleShape- Parameters:
shapeType- - shapeType- See Also:
HSSFShapeTypes
-
cloneShape
protected HSSFShape cloneShape()
- Overrides:
cloneShapein classHSSFSimpleShape
-
getClientAnchor
public HSSFClientAnchor getClientAnchor()
- Specified by:
getClientAnchorin interfacePicture- Returns:
- the anchor that is used by this picture.
-
-