aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java')
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java
index 93fa26f5ba..267bd2e1d6 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java
@@ -22,6 +22,7 @@ import org.apache.poi.ddf.EscherBitmapBlip;
import org.apache.poi.ddf.EscherBlipRecord;
import org.apache.poi.ddf.EscherMetafileBlip;
import org.apache.poi.ss.usermodel.PictureData;
+import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.PngUtils;
/**
@@ -131,4 +132,33 @@ public class HSSFPictureData implements PictureData
return "image/unknown";
}
}
+
+ /**
+ * @return the POI internal image type, -1 if not unknown image type
+ *
+ * @see Workbook#PICTURE_TYPE_DIB
+ * @see Workbook#PICTURE_TYPE_EMF
+ * @see Workbook#PICTURE_TYPE_JPEG
+ * @see Workbook#PICTURE_TYPE_PICT
+ * @see Workbook#PICTURE_TYPE_PNG
+ * @see Workbook#PICTURE_TYPE_WMF
+ */
+ public int getPictureType() {
+ switch (blip.getRecordId()) {
+ case EscherMetafileBlip.RECORD_ID_WMF:
+ return Workbook.PICTURE_TYPE_WMF;
+ case EscherMetafileBlip.RECORD_ID_EMF:
+ return Workbook.PICTURE_TYPE_EMF;
+ case EscherMetafileBlip.RECORD_ID_PICT:
+ return Workbook.PICTURE_TYPE_PICT;
+ case EscherBitmapBlip.RECORD_ID_PNG:
+ return Workbook.PICTURE_TYPE_PNG;
+ case EscherBitmapBlip.RECORD_ID_JPEG:
+ return Workbook.PICTURE_TYPE_JPEG;
+ case EscherBitmapBlip.RECORD_ID_DIB:
+ return Workbook.PICTURE_TYPE_DIB;
+ default:
+ return -1;
+ }
+ }
}