Class HSSFPicture

    • Method Detail

      • getPictureIndex

        public int getPictureIndex()
      • setPictureIndex

        public void setPictureIndex​(int pictureIndex)
      • resize

        public void 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 streched vertically or horizontally.

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

        public void resize​(double scaleX,
                           double scaleY)
        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 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 HSSFClientAnchor getPreferredSize()
        Calculate the preferred size for this picture.
        Specified by:
        getPreferredSize in interface Picture
        Returns:
        HSSFClientAnchor with the preferred size for this image
        Since:
        POI 3.0.2
      • getPreferredSize

        public HSSFClientAnchor 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:
        HSSFClientAnchor with the preferred size for this image
        Since:
        POI 3.0.2
      • getPreferredSize

        public HSSFClientAnchor 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:
        HSSFClientAnchor with the preferred size for this image
        Since:
        POI 3.11
      • getImageDimension

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

        public HSSFPictureData getPictureData()
        Return picture data for this shape
        Specified by:
        getPictureData in interface Picture
        Returns:
        picture data for this shape or null if picture wasn't embedded, i.e. external linked
      • getFileName

        public String getFileName()
        The filename of the embedded image
      • setFileName

        public void setFileName​(String data)
      • getSheet

        public HSSFSheet getSheet()
        Specified by:
        getSheet in interface Picture
        Returns:
        the sheet which contains the picture shape