HTML tags order

Hi,


I was using Aspose.Slides for Java 16.10.0 to convert presentations to HTML and mark beginning and ending of each portion. I achieved this by adding an hyperlinked “zero-width space” portion before and after each regular portion. So the structure of the HTML file looked like this:

Simple text
<span style=“font-family: “Courier New”; font-size: small;”>

I switched today to Aspose.Slides for Java 17.4.0 and I noticed that the structure changed even though I’m using the same piece of code to achieve above mentioned result. As you can see, Simple text became a child of the second hyperlinked portion.
<span style=“font-family: “Courier New”; font-size: small;”>

These two hyperlinked portions do not wrap my Simple text portion anymore.

Here’s the code to generate HTML files:

String path = “SimpleText.pptx”;

Presentation presentation = new Presentation(path);

ISlide slide = presentation.getSlides().get_Item(0);

IAutoShape shape = (IAutoShape) slide.getShapes().get_Item(0);

IParagraph paragraph = shape.getTextFrame().getParagraphs().get_Item(0);

IPortionCollection portions = paragraph.getPortions();

portions.clear();

// add hyperlinked zero-width portion
IPortion zeroWidth = new Portion(“\u200B”);
zeroWidth.getPortionFormat().setHyperlinkClick(new Hyperlink(“http://www.google.com”));

portions.add(zeroWidth);

// add text
portions.add(new Portion(“Simple text”));

// add hyperlinked zero-width portion
zeroWidth = new Portion(“\u200B”);
zeroWidth.getPortionFormat().setHyperlinkClick(new Hyperlink(“http://www.google.com”));

portions.add(zeroWidth);
presentation.save(“SimpleText-17.4.0.html”, SaveFormat.Html);

Can you check this?

Thanks,
Zeljko

Hi Zeljko,

Thanks for sharing the detailed response.

I have worked with the sample code using both Aspose.Slides for Java 16.10.0 and Aspose.Slides for Java 17.4 on my end, and obtained similar HTML files as shared by you. The issue seems to be in Aspose.Slides for Java 17.4 as it is inserting hyperlink for string: Sample Text in presentation which is not right. For that reason, you are observing Sample Text as child of second hyperlinked portion. An issue with ID SLIDESJAVA-36377 has been added as a regression 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 fixed.

We are sorry for your inconvenience,