I confirmed the problem: shape.getAnchor() returns null when reading
shapes from worksheet.

Can you create a new bug in Bugzilla and attach sample Java code that
demonstrates the problem and the .xlsx file you are reading.

Yegor

On Wed, Jul 18, 2012 at 5:02 PM, Toni Helenius
<[email protected]> wrote:
> Hello,
>
> I'm converting some HSSF specific code to use the generic SS one. I keep 
> getting NPEs from XSSFPicture functions (using the Interface, Picture) since 
> they don't contain anchors. Anchors are null. This generic code works just 
> fine on HSSF.
>
> I also need the locations of the images, so the getAllImages() just doesn't 
> cut it.
>
> XSSFDrawing drawing = ((XSSFSheet)sheet).createDrawingPatriarch();
>
> // Get the shapes
> for (XSSFShape shape : drawing.getShapes()) {
>         if (shape instanceof Picture) {
>                 ClientAnchor anchor = picture.getPreferredSize(); //Fails on 
> XSSF
>                 }
>         }
>
> I found something here, possibly some coordinates that I need to convert but 
> this seems very ugly. If it even works...
> ((XSSFPicture)picture).getCTPicture().getSpPr().getXfrm().getOff();
>
> Can somebody help me please?
>
> --
> Toni Helenius
> Syncron Tech Oy
> FIN-53850 LAPPEENRANTA
> Street address: Laserkatu 6
> Mobile: +358 (0) 400 213 218
> Tel: +358 (0) 102176908
> Fax: +358 (0) 102176907
> www.syncrontech.com
> [email protected]
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to