We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using aspose autoshapes


attached is a ppt which contains shapes like a circle, triangle etcin the 2 slides the actual data is generated with these arrows pointing to these shapes programatically. can you give the actual code which i can use to serailize these shapes and use in the presentation programatically. Basically i want code to serailze and use these shapes.



At first, you should create presentation with autoshapes you will use later.
After that serialize all these autoshapes to files:

Slide slide = …;
Shapes.shapes = slide.getShapes();

for (int i = 0; i < shapes.size(); i++) {
Shape sh = shapes.get(i);
sh.serialize(new FileOutputStream(new File(“autoshape” + i + “.ash”)));

That is better to serialize exactly the same autoshapes you need use later.

Now you can insert saved shapes in new presentations.
That is short example how to read it and insert to a slide.

Slide slide = …;
Shapes shapes = slide.getShapes();

Shape shape = shapes.add(new FileInputStream(new File(“autoshape1.ash”)))
// Move and resize created autoshape.

I’m using PPT and need to add an autoshape. Looks like the only way to do that is to create a PPT file with the shape in it and then import it into the presentation…? In that case, why is there interface AutoShapeType? I didn’t see any documentation about how to create an autoshape via getShapes().addAutoShape(), the way PPTX does it.

Dear Prashanth,

You can serialize the PPT shapes programmatically. Please follow this documentation link for PPT slides shapes serialization. Please share with us if you have any further queries.

Thanks and Regards,