Top Description Methods
org.apache.poi.ss.usermodel

public Interface Picture

extends Shape
Known Direct Implementers
org.apache.poi.hssf.usermodel.HSSFPicture
Imports
java.awt.Dimension

Repersents a picture in a SpreadsheetML document

Method Summary

Modifier and TypeMethod and Description
public ClientAnchor

Returns:

the anchor that is used by this picture
getClientAnchor
()

public Dimension

Returns:

image dimension in pixels
getImageDimension
()

Return the dimension of the embedded image in pixel

public PictureData

Returns:

picture data for this picture
getPictureData
()

Return picture data for this picture

public ClientAnchor

Returns:

XSSFClientAnchor with the preferred size for this image
getPreferredSize
()

Calculate the preferred size for this picture.

public ClientAnchor

Returns:

ClientAnchor 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
)

Calculate the preferred size for this picture.

public Sheet

Returns:

the sheet which contains the picture
getSheet
()

public void
resize()

Reset the image to the dimension of the embedded image

public void
resize(double scale)

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
)

Resize the image.

Inherited from org.apache.poi.ss.usermodel.Shape:
getAnchorgetParentgetShapeNameisNoFillsetFillColorsetLineStyleColorsetNoFill

Method Detail

getClientAnchorback to summary
public ClientAnchor getClientAnchor()
Returns:ClientAnchor

the anchor that is used by this picture

getImageDimensionback to summary
public Dimension getImageDimension()

Return the dimension of the embedded image in pixel

Returns:Dimension

image dimension in pixels

getPictureDataback to summary
public PictureData getPictureData()

Return picture data for this picture

Returns:PictureData

picture data for this picture

getPreferredSizeback to summary
public ClientAnchor getPreferredSize()

Calculate the preferred size for this picture.

Returns:ClientAnchor

XSSFClientAnchor with the preferred size for this image

getPreferredSizeback to summary
public ClientAnchor getPreferredSize(double scaleX, double scaleY)

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:ClientAnchor

ClientAnchor with the preferred size for this image

getSheetback to summary
public Sheet getSheet()
Returns:Sheet

the sheet which contains the picture

resizeback to summary
public void resize()

Reset the image to the dimension of the embedded image

See Also
resize(double, double)
resizeback to summary
public void resize(double scale)

Resize the image proportionally.

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

Resize the image.

Please note, that this method works correctly only for workbooks with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx). 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.