* WordPerfect graphics (.wpg)
*/
public static final int PICTURE_TYPE_WPG = PictureType.WPG.ooxmlId;
+
+ /**
+ * SVG graphics (.svg)
+ */
+ public static final int PICTURE_TYPE_SVG = PictureType.SVG.ooxmlId;
}
protected static final POIXMLRelation[] RELATIONS;
static {
- RELATIONS = new POIXMLRelation[14];
+ RELATIONS = new POIXMLRelation[15];
RELATIONS[PictureType.EMF.ooxmlId] = XWPFRelation.IMAGE_EMF;
RELATIONS[PictureType.WMF.ooxmlId] = XWPFRelation.IMAGE_WMF;
RELATIONS[PictureType.PICT.ooxmlId] = XWPFRelation.IMAGE_PICT;
RELATIONS[PictureType.BMP.ooxmlId] = XWPFRelation.IMAGE_BMP;
RELATIONS[PictureType.WPG.ooxmlId] = XWPFRelation.IMAGE_WPG;
RELATIONS[PictureType.WDP.ooxmlId] = XWPFRelation.HDPHOTO_WDP;
+ RELATIONS[PictureType.SVG.ooxmlId] = XWPFRelation.IMAGE_SVG;
}
private Long checksum;
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_PNG
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_GIF
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_DIB
+ * @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_SVG
* @see #getPictureTypeEnum()
*/
public int getPictureType() {
"/ppt/media/hdphoto#.wdp",
XWPFPictureData::new, XWPFPictureData::new
);
+ public static final XWPFRelation IMAGE_SVG = new XWPFRelation(
+ PictureType.SVG.contentType,
+ IMAGE_PART,
+ "/word/media/image#.svg",
+ XWPFPictureData::new, XWPFPictureData::new
+);
public static final XWPFRelation IMAGES = new XWPFRelation(
null,
IMAGE_PART,
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_PNG
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_GIF
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_DIB
+ * @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_SVG
* @see #addPicture(InputStream, PictureType, String, int, int)
*/
public XWPFPicture addPicture(InputStream pictureData, int pictureType, String filename, int width, int height)
doc.addPictureData(new byte[18], Document.PICTURE_TYPE_EPS);
doc.addPictureData(new byte[19], Document.PICTURE_TYPE_BMP);
doc.addPictureData(new byte[20], Document.PICTURE_TYPE_WPG);
+ doc.addPictureData(new byte[21], Document.PICTURE_TYPE_SVG);
- assertEquals(11, doc.getAllPictures().size());
+ assertEquals(12, doc.getAllPictures().size());
try (XWPFDocument doc2 = XWPFTestDataSamples.writeOutAndReadBack(doc)) {
- assertEquals(11, doc2.getAllPictures().size());
+ assertEquals(12, doc2.getAllPictures().size());
}
}
}
/** Microsoft Windows Media Photo image (.wdp) */
WDP("image/vnd.ms-photo", ".wdp", 13),
/** Scalable vector graphics (.svg) - supported by Office 2016 and higher */
- SVG("image/svg+xml", ".svg", -1),
+ SVG("image/svg+xml", ".svg", 14),
/** Unknown picture type - specific to escher bse record */
UNKNOWN("", ".dat", -1),
/** Picture type error - specific to escher bse record */