Free Support Forum - aspose.com

Creating new PTTX files (c#)

I down loaded the most recent trial version of Aspose slides. I am having trouble creating a PPTX file would you provide or point me in the direction of a code snippet to create and save a new PPTX file.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

PS I have done this with OpenXML but I am looking for a more straight forward way to create and manipulate PTTX files.

Thanks

Never mind I found some documentation allowing me to add a using statement and then grab the PPTX objects.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

using Aspose.Slides.Pptx;

PresentationEx pres = new PresentationEx();

Hi Jeff,

Here is a sample code for creating a PPTX with some picture:

byte[] buff = null;

FileStream fs = new FileStream("d:\\ppt\\neoteny\\result.png", FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fs);

long numBytes = new FileInfo("d:\\ppt\\neoteny\\result.png").Length;

buff = br.ReadBytes((int)numBytes);

MemoryStream st = new MemoryStream(buff);

System.Drawing.Image img;

img = System.Drawing.Bitmap.FromStream(st);

PresentationEx pres = new PresentationEx();

SlideEx sld = pres.Slides[0];

ImageEx img1 = pres.Images.AddImage(img);

sld.Shapes.AddPictureFrame(ShapeTypeEx.Rectangle, 25, 25, 500, 500, img1);

pres.Write("d:\\ppt\\jan\\pres1.pptx");

<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p>

Thanks Muhammad

I am having trouble adding a slide to the presentation. The it seems to want a layoutSlideEx layout however I am unable to find any examples of this. I would like to add a new slide then add a chart with an embedded workbook using Aspose.Cells. A simple example would be very helpful.

SlideEx newSlide = pres.Slides.AddEmptySlide();

Thanks,

JeffB

Hello Jeff,

While I was searching for similar information, I came across following links. I hope they can help you out while accomplishing your requirements. Please have a look.

Embedding Excel Object into PPTX slide

Aspose.Slides for .NET - 2007 PPTX Question

how to add a chart dynamicaly to a slide

Well in my point of view, before you start reading the above posts, please have a look over the following article which explains the complete process. Even though its for Presentation Object not PresentationEx but still you would be having a very good idea of the complete process. Creating Excel Chart and Embedding it in Presentation as OLE Object