Free Support Forum - aspose.com

Content moved in generated HTML (1580)


#1

Hi,

I’m using a slightly modified code I posted here to generate HTML of the attached presentations. In Aspose.Slides for Java 18.2, unexpected underscores have been fixed. But I have another problem with moved and cut off content. Please see the attached screenshots

Here’s the code:

private static final String ZERO_WIDTH_SPACE_CHARACTER = "\u200B";
private static final String URL = "http://example.com/";

public static void main(String[] args) throws Exception {

String filePath = args[0];
String targetPath = args[1];

Presentation presentation = new Presentation(filePath);

ISlideCollection slides = presentation.getSlides();

for (ISlide slide : slides) {

    IShapeCollection shapes = slide.getShapes();

    for (IShape shape : shapes) {

	if (shape instanceof IAutoShape) {

	    IAutoShape autoShape = (IAutoShape) shape;

	    ITextFrame textFrame = autoShape.getTextFrame();

	    if (textFrame != null) {

		IParagraphCollection paragraphs = textFrame.getParagraphs();

		for (IParagraph paragraph : paragraphs) {

		    IPortionCollection portions = paragraph.getPortions();

		    List<IPortion> temporaryPortions = new ArrayList<>();

		    for (IPortion portion : portions) {
			if (!portion.getText().trim().isEmpty()) {
			    temporaryPortions.add(createHyperlinkPortion());
			    temporaryPortions.add(portion);
			    temporaryPortions.add(createHyperlinkPortion());
			}
		    }

		    portions.clear();

		    for (IPortion portion : temporaryPortions) {
			portions.add(portion);
		    }
		}
	    }
	}
    }
}

presentation.save(targetPath, SaveFormat.Html);

presentation.dispose();
}

private static IPortion createHyperlinkPortion() {
IPortion portion = new Portion(ZERO_WIDTH_SPACE_CHARACTER);
portion.getPortionFormat().setHyperlinkClick(new Hyperlink(URL));
return portion;
}

Can you check this?

Thanks,
Zeljko

Immunology_panels_launch_presentation.PNG (301.7 KB)
NavisphereManagementSuite.PNG (190.6 KB)

Immunology_panels_launch_presentation.ppt.zip (779.6 KB)
NavisphereManagementSuite.ppt.zip (1.9 MB)


#2

@Zeljko,

I have worked with the presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESJAVA-36951 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 fixed.


#3

The issues you have found earlier (filed as SLIDESJAVA-36951) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz


#4

Hi, I’m still having the same issues here. Im using latest aspose slides for java (19.2).
Can you please check this?

Thanks,
Zeljko.


#5

@Zeljko,

I like to inform that we have investigated this issue on our end and we have added the necessary fixes to Aspose.Slides so that it matches the behaviour of PowerPoint. Please note that while adding zero-width portions to the text in the PowerPoint itself, this shift also occurs. This shift is not a bug, but the PowerPoint behaviour in the presence of zero-width portions.