How to set background image for a table cell in .NET WebForms ?
Essential 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.Cells 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");
I hope you enjoyed learning about how to set background image for a table cell.