1

I am trying to read a ppt file using the poi, and I would like to know how to read the autoshapes which are inserted in the ppt and store them into a different file according to the slide.

I am using the code below:

public void getAutoShapes()
    {
        for (int i = 0; i < _slides.length; i++) 
        {
            Slide slide = _slides[i];
            Shape[] autoshape = slide.getShapes();
            for (int j = 0; j < autoshape.length; j++)
            {
                if(autoshape[j].getShapeName()=="NotPrimitive")
                {
                    autoshape[j].typeName(autoshape[j].getShapeId());
                }
          }
        }
    }
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
Jithesh Chandra
  • 860
  • 7
  • 12

1 Answers1

0

For reading all types of shapes in pptx / XSLF . ..

BufferedImage img = new BufferedImage((int)width, (int)height, BufferedImage.TYPE_4BYTE_ABGR);
                       Graphics2D graphics = img.createGraphics();
                       graphics.translate(-aShape.getAnchor().getX(), -aShape.getAnchor().getY());
                       aShape.draw(graphics);
                       graphics.dispose();
                       //clear the drawing area
                       graphics.setPaint(Color.white);
                       graphics.fill(new Rectangle2D.Float((float)left,(float)top,(float)width,(float)height));
Jithesh Chandra
  • 860
  • 7
  • 12