Articles in this section
Category / Section

How to add images to a table cell using Essential Presentation library

1 min read

Essential Presentation library supports adding background images for table cells. You can add a background image for a table cell by choosing the “FillType” as “Picture” for the cell’s background.

 

Please find the code example for this as below.

 

//Create an instance of PowerPoint Presentation 
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a table with 4 rows and 4 columns with specified size.
ITable table = slide.Tables.AddTable(4, 4, 50, 50, 500, 400);
//Get an image instance from file.
Syncfusion.Drawing.Image image = Syncfusion.Drawing.Image.FromFile("image.png");
//Get the instance of first cell from first row.
ICell cell = table.Rows[0].Cells[0] as ICell;
//Set fill type as Picture.
cell.Fill.FillType = FillType.Picture;
//Set image bytes for picture fill image.
cell.Fill.PictureFill.ImageBytes = image.ImageData;
//Save presentation with specified file name.
presentation.Save("Table.pptx");

 

 

You can find the complete sample here.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied