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

Free Support Forum - aspose.com

AddFromHTML() throwing error with specific HTML text

Hi Team,

I am trying to write some text to the ppt in a rectangle. AddFromHtml throws exception saying, “Input string was not in correct format”.

Below is the HTML,

WHI and LEI percentile ranks are provided to most L80+ managers so they can see where their scores on these indices fall relative to the scores of others.


So If it remove the style attribute, style=“color:rgb(102, 102, 102)” from the span above it works good. It looks to be failing with the color attribute. Could you please le mw know if this is an issue with aspose or fixable?

Below is the code that I am using.

string title="

<span style=“font-family:segoe ui,sans-serif”>WHI and LEI percentile ranks are provided to most L80+ managers so they can see where their scores on these indices fall relative to the scores of others.

";
var rectangle = AddRectangle(slide, Color.White, null, X, Y, Width, Height, anchor);

var textFrame = rectangle.TextFrame;
textFrame.Paragraphs.AddFromHtml(title);

Thanks,
Priya

Hi Priya,


Thank you for posting.

I have observed your comments and like to share with you that I have modified the code which does not throw the error specified by you, even if the style tag is present. I have added the escape sequence character where necessary. However, the styling tags are not reflected in generated presentation, which is a missing feature and has been logged into our issue management system with ID SLIDESNET-37406 . This thread has been linked with the issue so that you may be notified as soon as the feature will be supported. Please try using the below code on your side and then share your kind feedback with us.

Presentation
pres = new Presentation();<o:p></o:p>

ISlide slide = pres.Slides[0];

//Add an AutoShape of Rectangle type

IAutoShape ashp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 0, 0, 400, 400);

//Add TextFrame to the Rectangle

ashp.AddTextFrame(" ");

ashp.FillFormat.FillType = FillType.NoFill;

//Accessing the text frame

ITextFrame txtFrame = ashp.TextFrame;

string title = "

WHI and LEI percentile ranks are provided to most L80+ managers so they can see where their scores on these indices fall relative to the scores of others.

";

txtFrame.Paragraphs.AddFromHtml(title);

pres.Save(@"D:\test_16.3.0.pptx", Aspose.Slides.Export.SaveFormat.Pptx);


Best Regards,