You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "y.Gao" <ji...@hotmail.com> on 2012/07/31 17:24:03 UTC

get Image from excel 2010

Hallo 
    
   I want to get a Picture from a workbook, I can get the Image in
excel2003, but not in excel 2007. code as follows
      
                // get all pictures
		List<XSSFPictureData> pictures = workbook.getAllPictures();

		XSSFSheet sheet = workbook.getSheetAt(0);

		//Make a mapping of Interger and XSSFPictureData
		Map<Integer,XSSFPictureData> map = new HashMap<Integer,XSSFPictureData>();

		for (XSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {

			XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
			int rowIndex = anchor.getRow1();
			if (shape instanceof XSSFPicture) {
				int rowmark = rowIndex;
				XSSFPicture picture = (XSSFPicture) shape;
				int pictureIndex = picture.getPictureIndex() - 1;
				XSSFPictureData pictureData = pictures.get(pictureIndex);//
                                map.put(rowmark, pictureData);


In HSSFSheet and HSSFPicture have the method sheet.getDrawingPatriarch() and 
getPictureIndex(). But there is no such method getDrawingPatriarch() in
XSSFSheet and getPictureIndex() in XSSFPicture, Is there any way to get
location of Picture and Index of Picture. 

I am using POI-3.8

Regards




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/get-Image-from-excel-2010-tp5710579.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: get Image from excel 2010

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
I have no time to play with any code today so wanted to ask whether you have
looked at the CTPicture bean? This object is encapsulated within the
XSSFPicture class and it might - that is might - be the gateway to finding
out the information you require. No promises on this one though as I have
not had the chance to look into it myself.

Yours

Mark B



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/get-Image-from-excel-2010-tp5710579p5710618.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: get Image from excel 2010

Posted by Toni Helenius <To...@syncrontech.com>.
Hi,

I've found no solution. I think it is up to POI people now :) There is the bug report. You can subscribe to it. And if you find a solution you can attach it to the bug report.

-----Original Message-----
From: y.Gao [mailto:jigong_liang@hotmail.com] 
Sent: 3. elokuuta 2012 13:26
To: user@poi.apache.org
Subject: RE: get Image from excel 2010

Hallo Helenius

      Yes, I think our problem is similar, is this a bug for POI 3.8? do you have any way to  solution?

Regards 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/get-Image-from-excel-2010-tp5710579p5710607.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: get Image from excel 2010

Posted by "y.Gao" <ji...@hotmail.com>.
Hallo Helenius

      Yes, I think our problem is similar, is this a bug for POI 3.8? do you
have any way to  solution?

Regards 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/get-Image-from-excel-2010-tp5710579p5710607.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: get Image from excel 2010

Posted by Toni Helenius <To...@syncrontech.com>.
Hi,

I think we share a common problem. Though the approach is different. I filed a bug a while ago:
https://issues.apache.org/bugzilla/show_bug.cgi?id=53568

-----Original Message-----
From: y.Gao [mailto:jigong_liang@hotmail.com] 
Sent: 31. heinäkuuta 2012 18:24
To: user@poi.apache.org
Subject: get Image from excel 2010

Hallo 
    
   I want to get a Picture from a workbook, I can get the Image in excel2003, but not in excel 2007. code as follows
      
                // get all pictures
		List<XSSFPictureData> pictures = workbook.getAllPictures();

		XSSFSheet sheet = workbook.getSheetAt(0);

		//Make a mapping of Interger and XSSFPictureData
		Map<Integer,XSSFPictureData> map = new HashMap<Integer,XSSFPictureData>();

		for (XSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {

			XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
			int rowIndex = anchor.getRow1();
			if (shape instanceof XSSFPicture) {
				int rowmark = rowIndex;
				XSSFPicture picture = (XSSFPicture) shape;
				int pictureIndex = picture.getPictureIndex() - 1;
				XSSFPictureData pictureData = pictures.get(pictureIndex);//
                                map.put(rowmark, pictureData);


In HSSFSheet and HSSFPicture have the method sheet.getDrawingPatriarch() and getPictureIndex(). But there is no such method getDrawingPatriarch() in XSSFSheet and getPictureIndex() in XSSFPicture, Is there any way to get location of Picture and Index of Picture. 

I am using POI-3.8

Regards




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/get-Image-from-excel-2010-tp5710579.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org