Class SXSSFPicture

java.lang.Object
org.apache.poi.xssf.streaming.SXSSFPicture
All Implemented Interfaces:
Picture, Shape

public final class SXSSFPicture extends Object implements Picture
Streaming version of Picture. Most of the code is a copy of the non-streaming XSSFPicture code. This is necessary as a private method getRowHeightInPixels of that class needs to be changed, which is called by a method call chain nested several levels. The main change is to access the rows in the SXSSF sheet, not the always empty rows in the XSSF sheet when checking the row heights.
  • Method Details

    • getCTPicture

      @Internal public 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 Picture
      See Also:
    • 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 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.
      See Also:
    • 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
    • getPictureData

      public XSSFPictureData getPictureData()
      Return picture data for this shape
      Specified by:
      getPictureData in interface Picture
      Returns:
      picture data for this shape
    • getAnchor

      public XSSFAnchor getAnchor()
      Specified by:
      getAnchor in interface Shape
      Returns:
      the anchor that is used by this shape.
    • resize

      public void resize(double scaleX, double scaleY)
      Description copied from interface: Picture
      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 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.
      scaleY - the amount by which the image height is multiplied relative to the original height.
    • getPreferredSize

      public XSSFClientAnchor getPreferredSize(double scaleX, double scaleY)
      Description copied from interface: Picture
      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:
      ClientAnchor with the preferred size for this image
    • getImageDimension

      public Dimension getImageDimension()
      Description copied from interface: Picture
      Return the dimension of the embedded image in pixel
      Specified by:
      getImageDimension in interface Picture
      Returns:
      image dimension in pixels
    • getClientAnchor

      public XSSFClientAnchor getClientAnchor()
      Specified by:
      getClientAnchor in interface Picture
      Returns:
      the anchor that is used by this picture
    • getDrawing

      public XSSFDrawing getDrawing()
    • getSheet

      public XSSFSheet getSheet()
      Specified by:
      getSheet in interface Picture
      Returns:
      the sheet which contains the picture
    • getShapeName

      public String getShapeName()
      Specified by:
      getShapeName in interface Shape
      Returns:
      the name of this shape
    • getParent

      public Shape getParent()
      Specified by:
      getParent in interface Shape
      Returns:
      the parent shape.
    • isNoFill

      public boolean isNoFill()
      Description copied from interface: Shape
      Whether this shape is not filled with a color
      Specified by:
      isNoFill in interface Shape
      Returns:
      true if this shape is not filled with a color.
    • setNoFill

      public void setNoFill(boolean noFill)
      Description copied from interface: Shape
      Sets whether this shape is filled or transparent.
      Specified by:
      setNoFill in interface Shape
      Parameters:
      noFill - if true then no fill will be applied to the shape element.
    • setFillColor

      public void setFillColor(int red, int green, int blue)
      Description copied from interface: Shape
      Sets the color used to fill this shape using the solid fill pattern.
      Specified by:
      setFillColor in interface Shape
    • setLineStyleColor

      public void setLineStyleColor(int red, int green, int blue)
      Description copied from interface: Shape
      The color applied to the lines of this shape.
      Specified by:
      setLineStyleColor in interface Shape