Package org.apache.poi.xssf.usermodel
Class XSSFPictureData
- java.lang.Object
-
- org.apache.poi.ooxml.POIXMLDocumentPart
-
- org.apache.poi.xssf.usermodel.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getData()Gets the picture data as a byte array.static intgetMaxImageSize()java.lang.StringgetMimeType()Returns the mime type for the imageintgetPictureType()static voidsetMaxImageSize(int length)java.lang.StringsuggestFileExtension()Suggests a file extension for this image.-
Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommitted, setCommitted, toString
-
-
-
-
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:
getDatain interfacePictureData- Returns:
- the picture data.
-
suggestFileExtension
public java.lang.String suggestFileExtension()
Description copied from interface:PictureDataSuggests a file extension for this image.- Specified by:
suggestFileExtensionin interfacePictureData- Returns:
- the file extension, without a leading
.. Nevernull, but will be empty if the extension is unknown or if the file backing these data does not have an extension.
-
getPictureType
public int getPictureType()
- Specified by:
getPictureTypein interfacePictureData- Returns:
- the POI internal image type,
0if unknown image type - See Also:
Workbook.PICTURE_TYPE_DIB,Workbook.PICTURE_TYPE_EMF,Workbook.PICTURE_TYPE_JPEG,Workbook.PICTURE_TYPE_PICT,Workbook.PICTURE_TYPE_PNG,Workbook.PICTURE_TYPE_WMF
-
getMimeType
public java.lang.String getMimeType()
Description copied from interface:PictureDataReturns the mime type for the image- Specified by:
getMimeTypein interfacePictureData
-
-