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
”;
- Item 1
- Item 2
String listsNoError = “Regular Para
- Item 1
- 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