Articles in this section
Category / Section

How to set background image for a table cell in WinForms ?

2 mins read

Essential  .NET PowerPoint library does not provide direct support for 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("BackgroundImage.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 for picture fill image.
cell.Fill.PictureFill.ImageBytes = image.ImageData;
//Save presentation with specified file name.
presentation.Save("Table.pptx");
//Start the presentation
Process.Start("Table.pptx");

 

 

You can find the complete sample here.

 

Conclusion

I hope you enjoyed learning about how to set background image for a table cell.

You can refer to our .NET PowerPoint library’s feature tour page to know about its other groundbreaking feature representations.

For current customers, you can check out our File Formats from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET PowerPoint and other File Formats framework.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

 

 

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