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