Summary: | EMF images embedded in excel spreadsheet are returned much smaller the actual file image | ||
---|---|---|---|
Product: | POI | Reporter: | Barry <jbjhschiff> |
Component: | XSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 3.14-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: | example file with emf picture |
Description
Barry
2016-04-08 18:55:36 UTC
By the way it was using Office 2016 Created attachment 33745 [details]
example file with emf picture
It's always a pity when a bug entry is not accompanied by an example file. So I've made up one myself (via Office 20169 ... and it works ... with the following code @Test public void emftest() throws IOException { InputStream inp = new FileInputStream("emftest.xlsx"); XSSFWorkbook wb = new XSSFWorkbook(inp); XSSFSheet sheet = wb.getSheetAt(0); for (XSSFShape shape : sheet.getDrawingPatriarch().getShapes()) { XSSFPicture picture = (XSSFPicture) shape; byte[] imageBytes = picture.getPictureData().getData(); FileOutputStream fos = new FileOutputStream("bla.emf"); fos.write(imageBytes); fos.close(); } wb.close(); inp.close(); } I did not say it did not work. i said the returned file is not the full size/resolution as the original and the quality is often un-usable. Are you saying the this does not happen with you> yes ... the files extracted by POI vs. opening the .xlsx as .zip have the same size. If unsure, add another example .xlsx! |