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

Free Support Forum - aspose.com

'Can't parse coordinate' failure in IParagraphCollection.addFromHtml (version 18.9 java)

IParagraphCollection.addFromHtml fails (version 18.9 java)

The following is the result of

new Presentation().getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 200, 200).getTextFrame().getParagraphs().addFromHtml("<span style=“font-size: small;”>Test</span>");

class com.aspose.slides.exceptions.InvalidOperationException: Can’t parse coordinate.
at com.aspose.slides.internal.k5.i.else(Unknown Source)
at com.aspose.slides.ajk.do(Unknown Source)
at com.aspose.slides.ajk.do(Unknown Source)
at com.aspose.slides.qv.do(Unknown Source)
at com.aspose.slides.qs.if(Unknown Source)
at com.aspose.slides.qs.do(Unknown Source)
at com.aspose.slides.ParagraphCollection.addFromHtml(Unknown Source)
at com.aspose.slides.ParagraphCollection.addFromHtml(Unknown Source)

The same method invocation with"<span style=“font-size: small;”>Test</span>" succeeds!

@nlpwc,

I have used following sample code on my end using Aspose.Slides for Java 18.9 and have not been able to reproduce the issue. I suggest you to please try using following sample code.

public static void insertHtml()
{
  Presentation pres=new Presentation();
    ISlide slide=pres.getSlides().get_Item(0);
    IAutoShape ashp=slide.getShapes().addAutoShape(ShapeType.Rectangle,10,10,100,100);
    ashp.getTextFrame().getParagraphs().addFromHtml("<span style=“font-size: small;”>Test</span>");
    pres.save("C:\\Aspose Data\\Importhtml.pptx",SaveFormat.Pptx);
}

Importhtml.zip (19.5 KB)

Thanks Mudassir,

I checked the code I included in the post, and it has somehow removed the escape \ before the " in the string. The string tested should be “<span style=\“font-size: small;\”>Test</span>”
(To post a String in the forum it is apparently necessary to add s double \ to show up as a single one)

In your example there are the wrong type of quotes “ and ” instead of "

I have now included the relevant part of the code with correct quotes as an attachment.
snippet.java.zip (748 Bytes)
We would appreciate if you could run your test again. (It fails with us with the stack trace given before)

I also noted that the case that runs with us without an error has font-size: 8; instead of font-size: small;

Regards,
Ad

@nlpwc,

I have observed the information shared by you and have been able to observe the issue specified. An issue with ID SLIDESJAVA-37381 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESJAVA-37381) have been fixed in this update.