Adding one ppt file to another ppt file
I have got the task that if their i have one "power point file1" in desktop or any other location in computer, i need to create new "power point file2 " in asp.net and c# and add all the images of the "power point file1" into "power point file2" and also i should be able to edit the "power point file2" .so could you please send me the full code in c# and in asp.net..i have been searching for three days but couldnt find the answer.
Uehara AyakaPosted Jul 29, 2015, 11:18 PM
using Spire.Presentation;
using System.Drawing;
//load ppt1
Presentation ppt1 = new Presentation("sample.pptx",FileFormat.Pptx2010);
//create ppt2
Presentation ppt2 = new Presentation();
for (int i = 0; i < ppt1.Images.Count; i++)
{
//extract image from ppt1 and save to local folder
Image image = ppt1.Images[i].Image;
image.Save(string.Format("Images{0}.png", i));
string ImageFile2 = String.Format(@"Images{0}.png", i);
//add slide to ppt2
if (ppt2.Slides.Count - 1 < i)
{
ppt2.Slides.Append();
}
//draw images to ppt2
RectangleF rect = new RectangleF(50, 50, image.Width, image.Height);
ppt2.Slides[i].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile2, rect);
ppt2.Slides[i].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
}
//save and luanch the file
ppt2.SaveToFile("result.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("result.pptx");