org.apache.poi.xssf.usermodel
Class XSSFPicture

java.lang.Object
  extended by org.apache.poi.xssf.usermodel.XSSFShape
      extended by org.apache.poi.xssf.usermodel.XSSFPicture
All Implemented Interfaces:
org.apache.poi.ss.usermodel.Picture

public final class XSSFPicture
extends XSSFShape
implements org.apache.poi.ss.usermodel.Picture

Represents a picture shape in a SpreadsheetML drawing.

Author:
Yegor Kozlov

Field Summary
 
Fields inherited from class org.apache.poi.xssf.usermodel.XSSFShape
EMU_PER_PIXEL, EMU_PER_POINT, PIXEL_DPI, POINT_DPI
 
Method Summary
 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture getCTPicture()
          Return the underlying CTPicture bean that holds all properties for this picture
 org.apache.poi.ss.usermodel.PictureData getPictureData()
          Return picture data for this shape
 org.apache.poi.ss.usermodel.ClientAnchor getPreferredSize()
          Calculate the preferred size for this picture.
 XSSFClientAnchor getPreferredSize(double scale)
          Calculate the preferred size for this picture.
 void resize()
          Reset the image to the original size.
 void resize(double scale)
          Reset the image to the original size.
 
Methods inherited from class org.apache.poi.xssf.usermodel.XSSFShape
getAnchor, getDrawing, getParent, isNoFill, setFillColor, setLineStyle, setLineStyleColor, setLineWidth, setNoFill
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCTPicture

public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture getCTPicture()
Return the underlying CTPicture bean that holds all properties for this picture

Returns:
the underlying CTPicture bean

resize

public void resize()
Reset the image to the original size.

Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.

Specified by:
resize in interface org.apache.poi.ss.usermodel.Picture

resize

public void resize(double scale)
Reset the image to the original size.

Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.

Specified by:
resize in interface org.apache.poi.ss.usermodel.Picture
Parameters:
scale - the amount by which image dimensions are multiplied relative to the original size. resize(1.0) sets the original size, resize(0.5) resize to 50% of the original, resize(2.0) resizes to 200% of the original.

getPreferredSize

public org.apache.poi.ss.usermodel.ClientAnchor getPreferredSize()
Calculate the preferred size for this picture.

Specified by:
getPreferredSize in interface org.apache.poi.ss.usermodel.Picture
Returns:
XSSFClientAnchor with the preferred size for this image

getPreferredSize

public XSSFClientAnchor 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:
XSSFClientAnchor with the preferred size for this image

getPictureData

public org.apache.poi.ss.usermodel.PictureData getPictureData()
Return picture data for this shape

Specified by:
getPictureData in interface org.apache.poi.ss.usermodel.Picture
Returns:
picture data for this shape