We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Html rendering in ppt

Hi team,

Is there any way to render the text with html tag in ppt.Now I have tried it but it is showing text with html tags not rendering.

how can I achive this when putting data in textframes.

Hi Gopal,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<o:p> </o:p>

Yes,
Aspose.Slides for .NET provides the feature to render the HTML text to a textframe.
Please see the following documentation link with sample code and details on how
to accomplish it.<o:p></o:p>

<o:p> </o:p>

Importing
and Exporting HTML Text in Presentation
<o:p></o:p>

<o:p> </o:p>

In
case you still face any issue, please share your sample code, input html and
resultant file with us. We will check it and get back to you.<o:p></o:p>

<o:p> </o:p>

Thanks
& Regards,<o:p></o:p>

I have created table and setting text as following.This is showing 'My name is gopal.' as text not rendering tag so that i can see it in bold.There may be some other html tags that come dynamically.

example.

int Table2_Position = table1.Y + table1.Height + 50;

//Adding a new table to the slide using specified table parameters

Aspose.Slides.

Table table2 = slide.Shapes.AddTable(80, Table2_Position, TableWidth, 10, 2, 2, 1, Color.FromArgb(191, 191, 191));

table2.GetCell(0, 1).TextFrame.Paragraphs[0].Portions[0].Text="My name is gopal.";

Please provide solution asap as I need it urgently.

Hi Gopal,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

As mentioned in the above documentation link I shared, you need to use Paragraphs.AddFromHtml() method to add the HTML content to a text frame. Please see the following sample code to get an understanding:

//Instantiate Presentation class that represents PPTX file

using (Presentation pres = new Presentation())

{

//Access first slide

ISlide sld = pres.Slides[0];

//Define columns with widths and rows with heights

double[] dblCols = {250, 250 };

double[] dblRows = { 50, 30, 30 };

//Add table shape to slide

ITable tbl = sld.Shapes.AddTable(100, 50, dblCols, dblRows);

tbl[0, 1].TextFrame.Paragraphs.AddFromHtml("My name is gopal.");

//Write PPTX to Disk

pres.Save("c:\\data\\table.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

}

But I am unable to find AddFromHtml() method and also not allowing index on table in following code

tbl[0, 1].TextFrame.Paragraphs.AddFromHtml("My name is gopal.");tbl[0, 1].TextFrame.Paragraphs.AddFromHtml("My name is gopal.");

We are using version 2.2

Hi Gopal,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The code and documentation link I shared works fine with our latest version of Aspose.Slides for .NET v14.3.0. The version you are using is very old and the feature might not be supported in that version. I would suggest you to upgrade to the latest version and try it.

Thanks & Regards,