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

Free Support Forum - aspose.com

Slides: Error inserting html with ul and ol tags

Hi,

I am having an issue inserting an html to a shape that has a “Shrink text on overflow” property selected (please see the attached pptx document). The document has one shape on it and I am trying to insert and html text portion to it. If the text contains both unordered and ordered lists where ordered list follows unordered list with at least one regular paragraph between them, I get an error on document save:

Exception in thread “main” java.lang.NullPointerException
at com.aspose.slides.bge.do(Unknown Source)
at com.aspose.slides.bge.if(Unknown Source)
at com.aspose.slides.bge.(Unknown Source)
at com.aspose.slides.TextFrame.do(Unknown Source)
at com.aspose.slides.AutoShape.do(Unknown Source)
at com.aspose.slides.AutoShape.ah_(Unknown Source)
at com.aspose.slides.bm.do(Unknown Source)
at com.aspose.slides.wl.do(Unknown Source)
at com.aspose.slides.wl.do(Unknown Source)
at com.aspose.slides.dc.do(Unknown Source)
at com.aspose.slides.ayx.do(Unknown Source)
at com.aspose.slides.asd.do(Unknown Source)
at com.aspose.slides.asd.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.save(Unknown Source)
at BulletErrorSimulation.main(BulletErrorSimulation.java:62)

Please see the code snippet below. There are 3 different html text portions to be inserted to the document. The error happens when “listsWithError” string is inserted. In other cases all works OK - at least I did not notice a problem with any other samples I tested.

FileInputStream fileInput = new FileInputStream( “c:/html-error.pptx”);
Presentation pres = new Presentation( fileInput );

ISlide slide = pres.getSlides().get_Item(0);
IAutoShape aShp = (IAutoShape) slide.getShapes().get_Item(0);
ITextFrame txtFrm = aShp.getTextFrame();

String listsWithError = “

Regular Para

  • Item 1
  • Item 2

Regular para

  1. Item 1
  2. Item 2
”;

String listsNoError = “

Regular Para

  1. Item 1
  2. Item 2

Regular Para

  • Item 1
  • Item 2
”;

String htmlNoLists = “

Regular Para

Another regular para

Regular Para

Another regular para

Regular Para

Another regular para

Regular Para

Another regular para

Regular Para

Another regular para

”;

txtFrm.getParagraphs().addFromHtml( listsWithError );

System.out.println("Html inserted: " + new Date());
FileOutputStream fileOutput = new FileOutputStream( “c:/outputBullets.pptx”);
pres.save( fileOutput, SaveFormat.Pptx );

Please let me know if this can be fixed.

Thanks,

Natasa

Hi Natasa,

I have worked with the sample presentation shared by you using Aspose.Slides for Java 14.6.0 on my end and have been able to reproduce the issue. An issue with ID SLIDESJAVA-34534 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 automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thank you very much, it works OK now.
Natasa