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
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final POIXMLRelation[]Deprecated.the field will be removed -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a new XSSFPictureData nodeprotectedXSSFPictureData(PackagePart part) Construct XSSFPictureData from a package part -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getData()Gets the picture data as a byte array.static intReturns the mime type for the imageintprotected void*PictureData objects store the actual content in the part directly without keeping a copy like all others therefore we need to handle them differently.static voidsetMaxImageSize(int length) Suggests a file extension for this image.Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, commit, createHyperlink, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getReferenceRelationship, getReferenceRelationships, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeReferenceRelationship, removeRelation, removeRelation, removeRelation, setCommitted, toString
-
Field Details
-
RELATIONS
Deprecated.the field will be removedRelationships for each known picture typeChanging this array has no effect, as POI uses its own copy.
-
-
Constructor Details
-
XSSFPictureData
protected XSSFPictureData()Create a new XSSFPictureData node- See Also:
-
XSSFPictureData
Construct XSSFPictureData from a package part- Parameters:
part- the package part holding the drawing data,- Since:
- 3.14-Beta1
-
-
Method Details
-
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
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:
-
getMimeType
Description copied from interface:PictureDataReturns the mime type for the image- Specified by:
getMimeTypein interfacePictureData
-
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:
prepareForCommitin classPOIXMLDocumentPart
-