Class XSSFPictureData

  • All Implemented Interfaces:
    PictureData

    public class XSSFPictureData
    extends POIXMLDocumentPart
    implements PictureData
    Raw picture data, normally attached to a SpreadsheetML Drawing. As a rule, pictures are stored in the /xl/media/ part of a SpreadsheetML package.
    • Method Detail

      • setMaxImageSize

        public static void setMaxImageSize​(int length)
        Parameters:
        length - the max image size allowed for XSSF pictures
      • getMaxImageSize

        public static int getMaxImageSize()
        Returns:
        the max image size allowed for XSSF pictures
      • getData

        public byte[] getData()
        Gets the picture data as a byte array.

        Note, that this call might be expensive since all the picture data is copied into a temporary byte array. You can grab the picture data directly from the underlying package part as follows:
        InputStream is = getPackagePart().getInputStream();

        Specified by:
        getData in interface PictureData
        Returns:
        the picture data.
      • suggestFileExtension

        public java.lang.String suggestFileExtension()
        Description copied from interface: PictureData
        Suggests a file extension for this image.
        Specified by:
        suggestFileExtension in interface PictureData
        Returns:
        the file extension, without a leading .. Never null, but will be empty if the extension is unknown or if the file backing these data does not have an extension.
      • getMimeType

        public java.lang.String getMimeType()
        Description copied from interface: PictureData
        Returns the mime type for the image
        Specified by:
        getMimeType in interface PictureData