This topic focuses on how to insert Image into PowerPoint Table using C#. It encompasses all the details to establish the environment, a step-by-step procedure to create and fill a table cell with an image, and working example that exhibits how to add image in PPTX Table in C#. The developed application can be used in any .NET configured environment like Windows, macOS or Linux.
Steps to Insert Image in PowerPoint Table using C#
- Set up the environment to add Aspose.Slides for .NET to insert a table image
- Instantiate the Presentation class object to add a new presentation and access the first slide from the slides collection
- Insert a table in the selected slide having the definite heights for rows and columns using the AddTable() method
- Insert the desired image inside the presentation image collection
- Access the cell belonging to the first row and column from the table and set added image inside that
- Save the presentation with the table image in the PPTX format
In the above steps, we have explained how to display image in PPTX Table in C#. The process will commence by creating a default presentation using an instance of the Presentation class and getting access to its first slide. In the subsequent steps, we will add a new table using AddTable() method by providing the number of rows and columns for the table, which is then followed by loading and adding the source image inside the presentation image collection. Finally, the desired cell from the table will be selected and the loaded image will be set for that particular cell before saving the output presentation on the disk.
Code to Insert Image in PowerPoint Table using C#
The above mentioned code example show how to insert a Table Image in a Slide using C# using simple API interface. We have added a table having a collection of columns and rows using an instance of the ITable class. The CellFormat instance exposed for any particular cell inside the table is used to set the fill format of the cell to an image using the FillType.Picture enumerator. Finally, the image is added inside the presentation image collection and used for the cell image for display.
In this topic, we have focused on how will you insert a table image in a Presentation using C#. If want to enhance your learning further about managing the tables inside the PowerPoint, refer to the article, How to Create a Table in PowerPoint using C#.