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

Free Support Forum - aspose.com

ArgumentException when Adding HTML with Duplicate Style Attributes

We are encountering an issue with Slides where some user provided HTML contains duplicate style attributes - looks like this causes an exception in Aspose.Slides shape.AddFromHtml method. Example c# code below:

using Aspose.Slides;
using HtmlAgilityPack;

var presentation = new Presentation();

var slide = presentation.Slides.AddEmptySlide(presentation.LayoutSlides.FirstOrDefault());

var group = slide.Shapes.AddGroupShape();

var newShape = group.Shapes.AddAutoShape(ShapeType.Rectangle, 0, 0, group.Width, 0);

string html = "<p style=\"box-sizing: content-box; box-sizing: content-box\">Some text</p>";

newShape.TextFrame.Paragraphs.AddFromHtml(html, null, "");

Thank you for describing the issue.

I’ve reproduced the problem with importing the HTML content with duplicate style attributes. The exception is appropriate for the situation, but I’ve added a ticket with ID SLIDESNET-43647 to our issue-tracking system. Our development team will look into improving the behavior for such cases. We will inform you of any progress.

The issues you found earlier (filed as SLIDESNET-43647) have been fixed in Aspose.Slides for .NET 23.1 (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.