Insert HTML with images into PowerPoint in Java

We have already demonstrated how to insert HTML formatted text to a Presentation slide by using Spire.Presentation for Java. This article will introduce the way to insert HTML with images to PowerPoint and each html tag will be added to the slide as a separate shape.

import com.spire.presentation.*;
import com.spire.presentation.collections.*;

public class AddHTMLWithImage {
    public static void main(String[] args) throws Exception {
        //Create an instance of presentation document
        Presentation ppt = new Presentation();
        //Get the shapes on the first slide.
        ShapeList shapes = ppt.getSlides().get(0).getShapes();
        //Add contents to shapes from HTML codes, which includes text and image.
        shapes.addFromHtml("<html><div><p>E-iceblue</p>" +
                "<p><img src='https://cdn.e-iceblue.com/C:\\Users\\Test1\\Desktop\\logo.png'/></p>" +
                "<p>Spire.Presentation for Java</p></html>");

        //Save the document
        String result = "output/insertHtmlWithImage.pptx";
        ppt.saveToFile(result, FileFormat.PPTX_2013);
    }
}

Insert HTML with images into PowerPoint in Java