Hello Al, Sorry to say that I do not have an answer for you but rather a couple of questions.
When you say that they are all instances of HSSFTExtbox, how do you know? Have you done a getClass().getName() (shapeList.get(i).getClass().getName()) on the contents of the shapes list? Secondly, I do wonder if - in order to contain text - you have to deal with the HSSFTextbox class. I cannot find anyweher in the javadoc that, for example, an HSSFPolygon can contain text. With this in mind, I do wonder if the HSSFPolygo contains an HSSFTextbox and the textbox holds the text. If that is the case, it may be that you need to see if the shape has a parent and, if so, what type of object that is. There is a getParent() method defined and it could be wirth iterating up the chain to see what you encounter. This could all be complete rubbish of course as I have never had to deal with shapes in a worksheet before so do feel free to ignore this post. Yours Mark B Al Vargas wrote: > > Hello Everyone, > > I'm having some trouble trying to read back some shapes from a > spreadsheet. I'm > mostly interested in reading back the type of shape and the text within > it. So > far my code looks like this: > > > FileInputStream myInput = new FileInputStream(fileName); > > POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput); > > HSSFWorkbook myWorkBook = new HSSFWorkbook(myFileSystem); > > HSSFSheet mySheet = myWorkBook.getSheetAt(1); > HSSFPatriarch x = mySheet.getDrawingPatriarch(); > > List<HSSFShape> shapeList = x.getChildren(); > > for (int i=0; i <shapeList.size(); i++) > { > HSSFTextbox types = (HSSFTextbox) shapeList.get(i); > System.out.println(" Shape #"+i+"Text > is"+types.getString().getString()); > } > > But types.getString().getString() always returns an empty string even > though the > shape has text in it. And also all the shapes returned by x.getChildren() > are > HSSFTextbox > > Thanks! > > Al > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@poi.apache.org > For additional commands, e-mail: user-h...@poi.apache.org > > > -- View this message in context: http://old.nabble.com/Reading-Shapes-tp28616186p28623523.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional commands, e-mail: user-h...@poi.apache.org