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

public Class HSSFPicture

extends HSSFSimpleShape
implements Picture
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.usermodel.Picture, org.apache.poi.ss.usermodel.Shape
Known Direct Subclasses
org.apache.poi.hssf.usermodel.HSSFObjectData
Imports
java.awt.Dimension, java.io.IOException, org.apache.commons.io.input.UnsynchronizedByteArrayInputStream, org.apache.poi.ddf.DefaultEscherRecordFactory, .EscherBSERecord, .EscherBlipRecord, .EscherClientDataRecord, .EscherComplexProperty, .EscherContainerRecord, .EscherOptRecord, .EscherPropertyTypes, .EscherSimpleProperty, .EscherTextboxRecord, org.apache.poi.hssf.model.InternalWorkbook, org.apache.poi.hssf.record.CommonObjectDataSubRecord, .EscherAggregate, .ObjRecord, org.apache.poi.ss.usermodel.ClientAnchor.AnchorType, .Picture, org.apache.poi.ss.util.ImageUtils, org.apache.poi.util.StringUtil

Represents an escher picture. Eg. A GIF, JPEG etc...

Field Summary

Inherited from org.apache.poi.hssf.usermodel.HSSFSimpleShape:
OBJECT_TYPE_ARCOBJECT_TYPE_COMBO_BOXOBJECT_TYPE_COMMENTOBJECT_TYPE_LINEOBJECT_TYPE_MICROSOFT_OFFICE_DRAWINGOBJECT_TYPE_OVALOBJECT_TYPE_PICTUREOBJECT_TYPE_RECTANGLEWRAP_BY_POINTSWRAP_NONEWRAP_SQUARE

Constructor Summary

AccessConstructor and Description
public
public
HSSFPicture(HSSFShape parent, HSSFAnchor anchor)

Constructs a picture object.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
protected HSSFShape
protected EscherContainerRecord
public HSSFClientAnchor

Returns:

the anchor that is used by this picture.
getClientAnchor
()

Implements org.apache.poi.ss.usermodel.Picture.getClientAnchor.

public String
getFileName()

The filename of the embedded image

public Dimension

Returns:

image dimension in pixels
getImageDimension
()

Implements org.apache.poi.ss.usermodel.Picture.getImageDimension.

Return the dimension of the embedded image in pixel

public HSSFPictureData

Returns:

picture data for this shape or null if picture wasn't embedded, i.e. external linked
getPictureData
()

Implements org.apache.poi.ss.usermodel.Picture.getPictureData.

Return picture data for this shape

public int
public HSSFClientAnchor

Returns:

HSSFClientAnchor with the preferred size for this image
getPreferredSize
()

Implements org.apache.poi.ss.usermodel.Picture.getPreferredSize.

Calculate the preferred size for this picture.

public HSSFClientAnchor

Returns:

HSSFClientAnchor with the preferred size for this image
getPreferredSize
(double
the amount by which image dimensions are multiplied relative to the original size.
scale
)

Calculate the preferred size for this picture.

public HSSFClientAnchor

Returns:

HSSFClientAnchor with the preferred size for this image
getPreferredSize
(double
the amount by which image width is multiplied relative to the original width.
scaleX
,
double
the amount by which image height is multiplied relative to the original height.
scaleY
)

Implements org.apache.poi.ss.usermodel.Picture.getPreferredSize.

Calculate the preferred size for this picture.

public HSSFSheet

Returns:

the sheet which contains the picture shape
getSheet
()

Implements org.apache.poi.ss.usermodel.Picture.getSheet.

public void
resize()

Implements org.apache.poi.ss.usermodel.Picture.resize.

Reset the image to the dimension of the embedded image

Please note, that this method works correctly only for workbooks with default font size (Arial 10pt for .xls).

public void
resize(double scale)

Implements org.apache.poi.ss.usermodel.Picture.resize.

Resize the image proportionally.

public void
resize(double
the amount by which the image width is multiplied relative to the original width.
scaleX
,
double
the amount by which the image height is multiplied relative to the original height.
scaleY
)

Implements org.apache.poi.ss.usermodel.Picture.resize.

Resize the image

Please note, that this method works correctly only for workbooks with default font size (Arial 10pt for .xls).

public void
public void
setPictureIndex(int pictureIndex)

public void
Inherited from org.apache.poi.hssf.usermodel.HSSFSimpleShape:
afterRemovecreateObjRecordcreateTextObjRecordgetShapeIdgetShapeTypegetStringgetTextObjectRecordgetWrapTextsetStringsetWrapText

Constructor Detail

HSSFPictureback to summary
public HSSFPicture(EscherContainerRecord spContainer, ObjRecord objRecord)
HSSFPictureback to summary
public HSSFPicture(HSSFShape parent, HSSFAnchor anchor)

Constructs a picture object.

Method Detail

afterInsertback to summary
pack-priv void afterInsert(HSSFPatriarch patriarch)

Overrides org.apache.poi.hssf.usermodel.HSSFSimpleShape.afterInsert.

Annotations
@Override
cloneShapeback to summary
protected HSSFShape cloneShape()

Overrides org.apache.poi.hssf.usermodel.HSSFSimpleShape.cloneShape.

Annotations
@Override
createSpContainerback to summary
protected EscherContainerRecord createSpContainer()

Overrides org.apache.poi.hssf.usermodel.HSSFSimpleShape.createSpContainer.

Annotations
@Override
getClientAnchorback to summary
public HSSFClientAnchor getClientAnchor()

Implements org.apache.poi.ss.usermodel.Picture.getClientAnchor.

Returns:HSSFClientAnchor

the anchor that is used by this picture.

Annotations
@Override
getFileNameback to summary
public String getFileName()

The filename of the embedded image

getImageDimensionback to summary
public Dimension getImageDimension()

Implements org.apache.poi.ss.usermodel.Picture.getImageDimension.

Return the dimension of the embedded image in pixel

Returns:Dimension

image dimension in pixels

Annotations
@Override
getPictureDataback to summary
public HSSFPictureData getPictureData()

Implements org.apache.poi.ss.usermodel.Picture.getPictureData.

Return picture data for this shape

Returns:HSSFPictureData

picture data for this shape or null if picture wasn't embedded, i.e. external linked

Annotations
@Override
getPictureIndexback to summary
public int getPictureIndex()
getPreferredSizeback to summary
public HSSFClientAnchor getPreferredSize()

Implements org.apache.poi.ss.usermodel.Picture.getPreferredSize.

Calculate the preferred size for this picture.

Returns:HSSFClientAnchor

HSSFClientAnchor with the preferred size for this image

Annotations
@Override
Since
POI 3.0.2
getPreferredSizeback to summary
public HSSFClientAnchor getPreferredSize(double scale)

Calculate the preferred size for this picture.

Parameters
scale:double

the amount by which image dimensions are multiplied relative to the original size.

Returns:HSSFClientAnchor

HSSFClientAnchor with the preferred size for this image

Since
POI 3.0.2
getPreferredSizeback to summary
public HSSFClientAnchor getPreferredSize(double scaleX, double scaleY)

Implements org.apache.poi.ss.usermodel.Picture.getPreferredSize.

Calculate the preferred size for this picture.

Parameters
scaleX:double

the amount by which image width is multiplied relative to the original width.

scaleY:double

the amount by which image height is multiplied relative to the original height.

Returns:HSSFClientAnchor

HSSFClientAnchor with the preferred size for this image

Annotations
@Override
Since
POI 3.11
getSheetback to summary
public HSSFSheet getSheet()

Implements org.apache.poi.ss.usermodel.Picture.getSheet.

Returns:HSSFSheet

the sheet which contains the picture shape

Annotations
@Override
resizeback to summary
public void resize()

Implements org.apache.poi.ss.usermodel.Picture.resize.

Reset the image to the dimension of the embedded image

Please 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.

Annotations
@Override
resizeback to summary
public void resize(double scale)

Implements org.apache.poi.ss.usermodel.Picture.resize.

Resize the image proportionally.

Annotations
@Override
See Also
resize(double, double)
resizeback to summary
public void resize(double scaleX, double scaleY)

Implements org.apache.poi.ss.usermodel.Picture.resize.

Resize the image

Please 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(Double#MAX_VALUE,Double#MAX_VALUE) resizes to the dimension of the embedded image.

Parameters
scaleX:double

the amount by which the image width is multiplied relative to the original width.

scaleY:double

the amount by which the image height is multiplied relative to the original height.

Annotations
@Override
setFileNameback to summary
public void setFileName(String data)
setPictureIndexback to summary
public void setPictureIndex(int pictureIndex)
setShapeTypeback to summary
public void setShapeType(int shapeType)

Overrides org.apache.poi.hssf.usermodel.HSSFSimpleShape.setShapeType.

Parameters
shapeType:int

Doc from org.apache.poi.hssf.usermodel.HSSFSimpleShape.setShapeType.

- shapeType

Annotations
@Override