Background Turns Blue and Text Turns White when Importing HTML to PPT in C#

Hi,


We are facing issue while trying to send HTML data to a PPT file. When we pass the data to the PPT file, the background of the defined area turns “BLUE” and the text inside turns “WHITE”.

Following are the set of code lines used to render the functionality.

IAutoShape autoshape4 = slide.Shapes.AddAutoShape(ShapeType.Rectangle, (float)PPT_CompetitorProfile_PositioningDimension.ContentText_X1,
(float)PPT_CompetitorProfile_PositioningDimension.ContentText_Y1,
(float)PPT_CompetitorProfile_PositioningDimension.ContentText_Width,
(float)PPT_CompetitorProfile_PositioningDimension.ContentText_Height);
autoshape4.TextFrame.Paragraphs.AddFromHtml(content);

We even tried forcing style inside the html we were passing:

autoshape4.TextFrame.Paragraphs.AddFromHtml(“body, html, h2, h1 { font-family: arial,sans-serif;}body { color: #222;}body { background: #fff;}” + content);

For rendering “Text” following is the code that we use and it works fine. However the same code does not allow HTML to be rendered:

IAutoShape autoshape3 = slide.Shapes.AddAutoShape(ShapeType.Rectangle, (float)position.SubTitle_X1,
(float)position.SubTitle_Y1,
(float)position.SubTitle_Width,
(float)position.SubTitle_Height);
autoshape3.UseBackgroundFill = true;
autoshape3.LineFormat.FillFormat.FillType = FillType.NoFill;

ITextFrame txtFrame3 = autoshape3.TextFrame;

IParagraph paragraph3 = txtFrame3.Paragraphs[0];
paragraph3.ParagraphFormat.Alignment = TextAlignment.Left;
paragraph3.ParagraphFormat.MarginLeft = 10;
IPortion portion3 = paragraph3.Portions[0];
portion3.Text = "Sub-Title: " + sectionSubTitle;
portion3.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion3.PortionFormat.FillFormat.FillType = FillType.Solid;


Could someone suggest where we should make changes to get the HTML rendered properly?

Hi Deepak,

Thanks for inquiring Aspose.Slides.

I have observed the requirements shared by you and request you to please share the working sample project along with generated and desired output. I also request you please share that which version of Aspose.Slides you are using on your end. I suggest you may please try using Aspose.Slides for .NET 15.9.0 as well on your end first as well. Please share the requested information so that I may help you further in this regard.

Many Thanks,

I am attaching my code and output ppt file.

This should be the output but i am not getting the desired output


Jill Smith 50
Eve Jackson 94
John Doe 80

Hi Deepak,

I have observed the sample code shared by you. You are in fact importing HTML table in Aspose.Slides. I regret to share at the moment the support for importing only HTML text is available in Aspose.Slides text frame. There is no option available to import HTML table. You need to create your own table using Aspose.Slides and then import the HTML data for respective cells in text frames of Aspose.Slides table. I have also added an issue with ID SLIDESNET-37059 as new feature request to further investigate the possibility of implementing requested support. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

We are sorry for your inconvenience,

The issues you found earlier (filed as SLIDESNET-37059) have been fixed in Aspose.Slides for .NET 23.7 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.