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.
    • Field Detail

      • RELATIONS

        protected static final POIXMLRelation[] RELATIONS
        Relationships for each known picture type
    • Constructor Detail

      • XSSFPictureData

        protected XSSFPictureData​(PackagePart part)
        Construct XSSFPictureData from a package part
        Parameters:
        part - the package part holding the drawing data,
        Since:
        POI 3.14-Beta1
    • 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.
      • prepareForCommit

        protected void prepareForCommit()
        *PictureData objects store the actual content in the part directly without keeping a copy like all others therefore we need to handle them differently.
        Overrides:
        prepareForCommit in class POIXMLDocumentPart