diff options
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java | 29 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/usermodel/PictureData.java | 4 |
2 files changed, 28 insertions, 5 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java index 8ee2010300..158d98c36d 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java @@ -81,10 +81,8 @@ public class HSSFPictureData implements PictureData * @see #getFormat * @return 'wmf', 'jpeg' etc depending on the format. never <code>null</code> */ - public String suggestFileExtension() - { - switch (blip.getRecordId()) - { + public String suggestFileExtension() { + switch (blip.getRecordId()) { case EscherMetafileBlip.RECORD_ID_WMF: return "wmf"; case EscherMetafileBlip.RECORD_ID_EMF: @@ -101,5 +99,26 @@ public class HSSFPictureData implements PictureData return ""; } } + + /** + * Returns the mime type for the image + */ + public String getMimeType() { + switch (blip.getRecordId()) { + case EscherMetafileBlip.RECORD_ID_WMF: + return "application/x-wmf"; + case EscherMetafileBlip.RECORD_ID_EMF: + return "application/x-emf"; + case EscherMetafileBlip.RECORD_ID_PICT: + return "image/x-pict"; + case EscherBitmapBlip.RECORD_ID_PNG: + return "image/png"; + case EscherBitmapBlip.RECORD_ID_JPEG: + return "image/jpeg"; + case EscherBitmapBlip.RECORD_ID_DIB: + return "image/bmp"; + default: + return "image/unknown"; + } + } } - diff --git a/src/java/org/apache/poi/ss/usermodel/PictureData.java b/src/java/org/apache/poi/ss/usermodel/PictureData.java index a799de88eb..954337829d 100644 --- a/src/java/org/apache/poi/ss/usermodel/PictureData.java +++ b/src/java/org/apache/poi/ss/usermodel/PictureData.java @@ -33,4 +33,8 @@ public interface PictureData { */ String suggestFileExtension(); + /** + * Returns the mime type for the image + */ + String getMimeType(); }
\ No newline at end of file |