How to Insert Image into PowerPoint Table using Java

This simple article focuses on how to insert Image into PowerPoint Table using Java. It exposes all the required information to set up the environment and a step-by-step procedure along with sample code to create and fill the slide table cell with an image that shows how to add image in PPTX Table in Java. This application can be used in any Java configured environment like macOS, Windows or Linux.

Steps to Insert Image in PowerPoint Table using Java

  1. Set up the environment to add Aspose.Slides for Java to insert a table image
  2. Initialize the Presentation class instance to add a new presentation and access the first slide from the slides collection
  3. Create a table inside the selected slide having definite heights for rows and columns using the addTable() method
  4. Add the loaded image inside the presentation image collection
  5. Load the cell belonging to the first row and column inside the table and set the image inside that
  6. Save the presentation having a table image in the PPTX format

We have explained how to display image in PPTX Table in Java using the aforementioned steps. First of all, a presentation will be created using a Presentation class object along with getting access to the first slide inside the slides collection. We will insert a new table by providing the numbers of rows and columns using the addTable() method, which is then followed by accessing the image from the disk and adding that inside the presentation image collection. Finally, we will set the image inside the selected table cell before saving the presentation in PPTX format on the disk.

Code to Insert Image in PowerPoint Table using Java

In the above example, we have demonstrated how to insert a Table Image in a Slide using Java using a few API calls. We have created a sample presentation and added a table having a collection of rows and columns using an ITable class object. 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 example, we have learnt about how will you insert a table image in a Presentation using Java. If you are interested in learning more about managing the tables inside the PowerPoint, refer to the topic, How to insert a Table in a slide using Java.

 English