Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xssf.usermodel
Class XSSFPicture

    java.lang.Object
      org.apache.poi.xssf.usermodel.XSSFShape
          org.apache.poi.xssf.usermodel.XSSFPicture

All Implemented Interfaces:
  Picture, Shape

    public final class XSSFPicture

extends XSSFShape
implements Picture

Represents a picture shape in a SpreadsheetML drawing.

Author:
  Yegor Kozlov

Field Summary

Fields inherited from class org.apache.poi.xssf.usermodel.XSSFShape
`anchor, drawing, EMU_PER_PIXEL, EMU_PER_POINT, parent, PIXEL_DPI, POINT_DPI`

Constructor Summary
`protected` | `XSSFPicture(XSSFDrawing drawing, org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture ctPicture)` Construct a new XSSFPicture object.

Method Summary
`XSSFClientAnchor` | `getClientAnchor()`
`org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture` | `getCTPicture()` Return the underlying CTPicture bean that holds all properties for this picture
`java.awt.Dimension` | `getImageDimension()` Return the dimension of the embedded image in pixel
`protected static java.awt.Dimension` | `getImageDimension(PackagePart part, int type)` Return the dimension of this image
`XSSFPictureData` | `getPictureData()` Return picture data for this shape
`XSSFClientAnchor` | `getPreferredSize()` Calculate the preferred size for this picture.
`XSSFClientAnchor` | `getPreferredSize(double scale)` Calculate the preferred size for this picture.
`XSSFClientAnchor` | `getPreferredSize(double scaleX, double scaleY)` Calculate the preferred size for this picture.
`java.lang.String` | `getShapeName()`
`protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties` | `getShapeProperties()` Returns xml bean with shape properties.
`XSSFSheet` | `getSheet()`
`protected static org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture` | `prototype()` Returns a prototype that is used to construct new shapes
`void` | `resize()` Reset the image to the dimension of the embedded image
`void` | `resize(double scale)` Resize the image proportionally.
`void` | `resize(double scaleX, double scaleY)` Resize the image relatively to its current size.
`protected void` | `setPictureReference(PackageRelationship rel)` Link this shape with the picture data

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
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.poi.ss.usermodel.Shape
`getAnchor, getParent, isNoFill, setFillColor, setLineStyleColor, setNoFill`

Constructor Detail

### XSSFPicture

    protected XSSFPicture(XSSFDrawing drawing,
                          org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture ctPicture)

  Construct a new XSSFPicture object. This constructor is called from `XSSFDrawing.createPicture(XSSFClientAnchor, int)`

  Parameters:
    `drawing` - the XSSFDrawing that owns this picture

Method Detail

### prototype

    protected static org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture prototype()

  Returns a prototype that is used to construct new shapes

  Returns:
    a prototype that is used to construct new shapes

### setPictureReference

    protected void setPictureReference(PackageRelationship rel)

  Link this shape with the picture data

  Parameters:
    `rel` - relationship referring the picture data

### getCTPicture

    @Internal
    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 dimension of the embedded image

  Specified by:
    `resize` in interface `Picture`
  See Also:
    `resize(double, double)`

### resize

    public void resize(double scale)

  Resize the image proportionally.

  Specified by:
    `resize` in interface `Picture`
  See Also:
    `resize(double, double)`

### resize

    public void resize(double scaleX,
                       double scaleY)

  Resize the image relatively to its current 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.

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

  Specified by:
    `resize` in interface `Picture`
  Parameters:
    `scaleX` - the amount by which the image width is multiplied relative to the original width, when set to `Double.MAX_VALUE` the width of the embedded image is used
    `scaleY` - the amount by which the image height is multiplied relative to the original height, when set to `Double.MAX_VALUE` the height of the embedded image is used

### getPreferredSize

    public XSSFClientAnchor getPreferredSize()

  Calculate the preferred size for this picture.

  Specified by:
    `getPreferredSize` in interface `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

### getPreferredSize

    public XSSFClientAnchor getPreferredSize(double scaleX,
                                             double scaleY)

  Calculate the preferred size for this picture.

  Specified by:
    `getPreferredSize` in interface `Picture`
  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:
    XSSFClientAnchor with the preferred size for this image

### getImageDimension

    protected static java.awt.Dimension getImageDimension(PackagePart part,
                                                          int type)

  Return the dimension of this image

  Parameters:
    `part` - the package part holding raw picture data
    `type` - type of the picture: `Workbook.PICTURE_TYPE_JPEG`, `Workbook.PICTURE_TYPE_PNG` or `Workbook.PICTURE_TYPE_DIB`
  Returns:
    image dimension in pixels

### getImageDimension

    public java.awt.Dimension getImageDimension()

  Return the dimension of the embedded image in pixel

  Specified by:
    `getImageDimension` in interface `Picture`
  Returns:
    image dimension in pixels

### getPictureData

    public XSSFPictureData getPictureData()

  Return picture data for this shape

  Specified by:
    `getPictureData` in interface `Picture`
  Returns:
    picture data for this shape

### getShapeProperties

    protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getShapeProperties()

  Description copied from class: `XSSFShape`
  Returns xml bean with shape properties.

  Specified by:
    `getShapeProperties` in class `XSSFShape`
  Returns:
    xml bean with shape properties.

### getClientAnchor

    public XSSFClientAnchor getClientAnchor()

  Specified by:
    `getClientAnchor` in interface `Picture`
  Returns:
    the anchor that is used by this shape.

### getSheet

    public XSSFSheet getSheet()

  Specified by:
    `getSheet` in interface `Picture`
  Returns:
    the sheet which contains the picture shape

### getShapeName

    public java.lang.String getShapeName()

  Specified by:
    `getShapeName` in interface `Shape`
  Returns:
    the name of this shape

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.