Free Support Forum - aspose.com

Insert an image of a static size into a cell

I want to insert an image into a table's cell. The image needs to be a fixed size, so I can't just set it as the background image of the cell. Is there a way to do this? If so, how?

-Jeff

Dear Jeff,

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

You cannot insert image into a table cell, but if you want to show border around the image (PictureFrame), it is possible

For example, the following code adds a picture with black border around it. I have attached the output presentation.

----------------------------------------------------------------------------

Presentation srcPres = new Presentation();

Slide fstSlide = srcPres.GetSlideByPosition(1);

//Add a new picture inside your presentation

//and save its picture id

Aspose.Slides.Picture pic = new Aspose.Slides.Picture(srcPres, @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg");

int picId = srcPres.Pictures.Add(pic);

//Add a picture frame to hold picture

PictureFrame picFrame = fstSlide.Shapes.AddPictureFrame(picId, 500, 500, 3000, 3000) as PictureFrame;

picFrame.LineFormat.ShowLines = true;

picFrame.LineFormat.ForeColor = Color.Black;

picFrame.LineFormat.Width = 3;

srcPres.Write(@"c:\outAddingPicture.ppt");

Is adding an image relative to a cell and row possible now, or should I still keep on adding it to the background image?


-Jeff

Hello,



That is limitation of Microsoft PowerPoint. It doesn’t allow inserting images to a table cell.