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

Free Support Forum - aspose.com

Presentation.save() lasts too long (1659)

Hi,

I’m trying to modify the attached presentation by clearing text from each paragraph’s portion collection and adding three new portions. The first one and the last one contain only the space character, while the middle one contains paragraph’s text. The problem occurs when I try to save the presentation. The action never completes.

Here’s the code I used:

    IPresentation presentation = new Presentation("1.pptx");

	ISlideCollection slides = presentation.getSlides();

	for (ISlide slide : slides) {

		IShapeCollection shapes = slide.getShapes();

		for (IShape shape : shapes) {

			if (shape instanceof IAutoShape) {

				ITextFrame textFrame = ((IAutoShape) shape).getTextFrame();

				if (textFrame != null) {

					IParagraphCollection paragraphs = textFrame.getParagraphs();

					for (IParagraph paragraph : paragraphs) {

						String paragraphText = paragraph.getText();

						IPortionCollection portions = paragraph.getPortions();

						if (portions.getCount() > 0) {

							IPortion formattingPortion = portions.get_Item(0);

							portions.clear();

							IPortion spacePortion = new Portion((Portion) formattingPortion);
							spacePortion.setText(" ");

							portions.add(spacePortion);

							IPortion newPortion = new Portion((Portion) formattingPortion);

							newPortion.setText(paragraphText);

							portions.add(newPortion);

							spacePortion = new Portion((Portion) formattingPortion);
							spacePortion.setText(" ");

							portions.add(spacePortion);

						}

					}

				}

			}

		}

	}

	FileOutputStream outputStream = new FileOutputStream("1-aspose.pptx");

	presentation.save(outputStream, SaveFormat.Pptx);

	outputStream.close();

Environment info:

Ubuntu 16.04 x64
java version “1.8.0_161”

Thanks,
Zeljko

1.pptx.zip (2.4 MB)

@Zeljko,

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

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