https://bz.apache.org/bugzilla/show_bug.cgi?id=58325
Bug ID: 58325 Summary: getShapes() returns zero if sheet has more than one embedded OLE object Product: POI Version: 3.12-FINAL Hardware: PC Status: NEW Severity: major Priority: P2 Component: XSSF Assignee: dev@poi.apache.org Reporter: leotam...@gmail.com I am trying to find out the position (sheet, row, column) of each embedded file in my workbook. I am testing my code with two different files both created and handled exclusively using Excel 2010: 1) lt.xlsx : only one embedded file in a single sheet 2) db.xlsx : three embedded files in a single sheet Code: public static void bugcheck(String path) throws EncryptedDocumentException, InvalidFormatException, FileNotFoundException, IOException{ Workbook wbook = WorkbookFactory.create(new FileInputStream(path)); if (wbook instanceof XSSFWorkbook ) { //test each sheet for (int n = 0; n < wbook.getNumberOfSheets(); n++){ XSSFSheet sheet = ((XSSFWorkbook)wbook).getSheetAt(n); System.out.print("sheet " + sheet.getSheetName() + " - "); XSSFDrawing drawing = ((XSSFSheet)sheet).getDrawingPatriarch(); //drawing = ((XSSFSheet)sheet).createDrawingPatriarch(); List<XSSFShape> shapes = drawing.getShapes(); System.out.println("drawing.getShapes().size() = " + drawing.getShapes().size()); Iterator<XSSFShape> it = shapes.iterator(); while(it.hasNext()) { XSSFShape shape = it.next(); System.out.println("Col1:"+((XSSFClientAnchor)shape.getAnchor()).getCol1()); System.out.println("Col2:"+((XSSFClientAnchor)shape.getAnchor()).getCol2()); System.out.println("Row1:"+((XSSFClientAnchor)shape.getAnchor()).getRow1()); System.out.println("Row2:"+((XSSFClientAnchor)shape.getAnchor()).getRow2()); } } } } Code returns the following: Testing: lt.xlsx sheet MetasNM001 - drawing.getShapes().size() = 1 Col1:1 Col2:1 Row1:2 Row2:2 Testing: db.xlsx sheet MetasNM001 - drawing.getShapes().size() = 0 sheet Plan1 - drawing.getShapes().size() = 0 The tested files are attached to this bug submission -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org