Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Aspose slides throws an exception when using addFromHtml

$
0
0
I'm importing html generated by CKEditor into slides using aspose 15.1.0 
an example html is
<p><span style="color: rgb(0,255,255);">test</span></p>

Importing this html will cause aspose to fail with a "Input string was not in the correct format" exception. 

The following junit test will reproduce the issue. 

@Test
public void htmlShouldBeImported() {
String html = "<p><span style=\"color: rgb(0,255,255);\">test</span></p>";
//String passHtml = "<html><p><span style=\"color: #00FFFF;\">bob was here</span></p></html>";
Presentation pres = new Presentation();
ISlide sld = pres.getSlides().get_Item(0);
IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 400, 400);
ashp.setUseBackgroundFill(false);
ITextFrame txtFrame = ashp.getTextFrame();
txtFrame.getParagraphs().addFromHtml(html); // exception will occur here.
}
It seems to be the rgb(0,255,255) in the span that causes the issue as replacing this with #00FFFF works fine. 

Doing this replace is my current workaround. (It does however add a bit of complexity to the code) 

This seems only to be an issue with slides. 


Viewing all articles
Browse latest Browse all 3131

Trending Articles