Hello,
Using Aspose.Slides version 17.1.0, html image tags are not being rendered by Paragraphs.AddFromHtml()
. We would like to use Paragraphs.AddFromHtml()
to import html that includes image tags. Is this possible? Below is a code example that does not work, attached is the resulting .pptx file.
//Creating a presenation instance
using (Presentation pres = new Presentation())
{
//Accessing the first slide
ISlide slide = pres.Slides[0];
//Adding and accessing Autoshape
IAutoShape aShp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 200, 200, 400, 200);
//Accessing the text frame of created autoshape
ITextFrame txtFrm = aShp.TextFrame;
//Removing the default exisiting paragraph
txtFrm.Paragraphs.RemoveAt(0);
//****The below lines of code, which include an html <img> tag, will not render the image in the resulting paragraph. We would like image to be rendered.
txtFrm.Paragraphs.AddFromHtml("<p>Some text with an img tag!<img src=\"http://cdn.images.express.co.uk/img/dynamic/151/590x/secondary/red-galaxy-454959.jpg\" /></p>");
txtFrm.Paragraphs.AddFromHtml("<p>Some text with an img tag!<img src='http://cdn.images.express.co.uk/img/dynamic/151/590x/secondary/red-galaxy-454959.jpg' /></p>");
txtFrm.Paragraphs.AddFromHtml("<p>Some text with an img tag!<img src=http://cdn.images.express.co.uk/img/dynamic/151/590x/secondary/red-galaxy-454959.jpg /></p>");
//Writing the presentation as a PPTX file
pres.Save("PPTXHtmlImport.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}