Currently there is no direct way to insert such shapes but workaround exists. 1. Create some template presentation and add necessary AutoShapes to a slide. 2. Using Aspose.Slides serialize these autoshapes to binary files. 3. Add these files as resources to your application or simply put it together with app binaries. 4. Now you can add shapes to a generated presentation from stream/file using Shapes.Add(Stream) method.
i have followed as mentioned above, but facing porblem.
i am not able to get any shapes when i say
Presentation presentation = new Presentation("temp.ppt");
Slide s = presentation.AddEmptySlide();
Aspose.Slides.Shapes shapes = s.Shapes;
MemoryStream ms = new MemoryStream(); for (int i = 0; i < shapes.Count; i++) { Aspose.Slides.Shape sh = shapes[i]; //Serialize the shape sh.Serialize(ms); } if (ms.Length > 0) { Aspose.Slides.Shape newShape = s.Shapes.Add(ms);
You create empty slide (without shapes!) and try to serialize these 0 shapes to a stream. As a result your stream is empty. You should create presentation in PowerPoint with all necessary autoshapes and serialize them. After that you can create new slides, load autoshapes from the stream and insert it to the new slide.
One more problem is each autoshape should be serialized to a separate stream. If you serialize everything to a one stream and try to read it back then it won’t work.
in my senario i will be having a template presentation where i will be having a template slide.
now if i add the template slide some shapes and use them it is not going to work for me.
for reasons below
1. first of all.. my slides will be of different chart types. so i need that shape only for a specific chart type say bar.
2. if i put that shape in the template slide and use that then as soon as the first slide is generated (say a radar type) the shape will be gone from the template slide(i think so...).
3. from second slide on... the template slide will be empty (no shapes).so for me to continue with generation of charts i have been adding an empty template.
know how can i add a shape for a bar type chart that is say a 3rd and 5th slide in my ppt.?