Created attachment 38105 [details] Excel picture i want to insert a picture object can directly double-click to open about OLE using apache-poi, XSSFWorkbook().addOlePackage(data, "test", "test.png", "test.png"); Function can be used normally,but After the attachment is clicked, a new thumbnail will be generated according to the program that opens the attachment on the computer where it is located to replace the display thumbnail I set, and the image will also be deformed. I want to know how this problem can be solved,thanks~
There's no way to stop Office to replace the embedded package manager symbol. The deformation of the icon is based on the replaced image and different dimension of it. So try one of ... * set AnchorType to MOVE_DONT_RESIZE * invest time in creating a icon close to the one a double-click would generate and set * or check, if the shape can be added via an OneCellAnchor. So instead of ... > final int oleIdx = wb.addOlePackage(content.getBytes(), objectName, objectName + fileExtension, objectName + fileExtension); > final Drawing<?> pat = sheet.createDrawingPatriarch(); > final ClientAnchor anchor = pat.createAnchor(0, 0, 0, 0, colNo, rowNo, colNo + 1, rowNo + 2);//tweak cell ranges to minimize image distortion > anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE); ... you/we need to check how to attach a OneCellAnchor [1] I close this issue now, as this belongs better in the mailing list [1] https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_oneCellAnchor_topic_ID0EYKLPB.html