*/
public static final int PICTURE_TYPE_WPG = 12;
+ /**
+ * Microsoft Windows Media Photo image (.wdp)
+ */
+ public static final int PICTURE_TYPE_WDP = 13;
+
/**
* Relationships for each known picture type
*/
protected static final POIXMLRelation[] RELATIONS;
static {
- RELATIONS = new POIXMLRelation[13];
+ RELATIONS = new POIXMLRelation[14];
RELATIONS[PICTURE_TYPE_EMF] = XSLFRelation.IMAGE_EMF;
RELATIONS[PICTURE_TYPE_WMF] = XSLFRelation.IMAGE_WMF;
RELATIONS[PICTURE_TYPE_PICT] = XSLFRelation.IMAGE_PICT;
RELATIONS[PICTURE_TYPE_EPS] = XSLFRelation.IMAGE_EPS;
RELATIONS[PICTURE_TYPE_BMP] = XSLFRelation.IMAGE_BMP;
RELATIONS[PICTURE_TYPE_WPG] = XSLFRelation.IMAGE_WPG;
+ RELATIONS[PICTURE_TYPE_WDP] = XSLFRelation.IMAGE_WDP;
}
private Long checksum = null;
import org.apache.poi.openxml4j.opc.PackagePart;\r
import org.apache.poi.openxml4j.opc.PackageRelationship;\r
import org.apache.poi.util.Beta;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;\r
-import org.openxmlformats.schemas.drawingml.x2006.main.STShapeType;\r
+import org.apache.xmlbeans.XmlCursor;\r
+import org.apache.xmlbeans.XmlObject;\r
+import org.openxmlformats.schemas.drawingml.x2006.main.*;\r
import org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps;\r
import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;\r
import org.openxmlformats.schemas.presentationml.x2006.main.CTPictureNonVisual;\r
\r
import javax.imageio.ImageIO;\r
+import javax.xml.namespace.QName;\r
import java.awt.Graphics2D;\r
import java.awt.geom.Rectangle2D;\r
import java.awt.image.BufferedImage;\r
// discard any custom tags associated with the picture being copied\r
nvPr.unsetCustDataLst();\r
}\r
+ if(blip.isSetExtLst()) {\r
+\r
+ CTOfficeArtExtensionList extLst = blip.getExtLst();\r
+ for(CTOfficeArtExtension ext : extLst.getExtList()){\r
+ String xpath = "declare namespace a14='http://schemas.microsoft.com/office/drawing/2010/main' $this//a14:imgProps/a14:imgLayer";\r
+ XmlObject[] obj = ext.selectPath(xpath);\r
+ if(obj != null && obj.length == 1){\r
+ XmlCursor c = obj[0].newCursor();\r
+ String id = c.getAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "embed"));//selectPath("declare namespace r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' $this//[@embed]");\r
+ String newId = getSheet().importBlip(id, p.getSheet().getPackagePart());\r
+ c.setAttributeText(new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "embed"), newId);\r
+ c.dispose();\r
+ }\r
+ }\r
+ }\r
\r
}\r
}\r