Hi there,
we have a problem with a new PresentationEx, initialized by a input stream.
byte[] presentationAsByte = null;
…
ByteArrayInputStream i = new ByteArrayInputStream(presentationAsByte);
PresentationEx pTemp = new PresentationEx(i);
pTemp.write("/home/…/pptx-current.pptx");
Since Aspose.slides.2.9.2, the text (TextFrameEx) in the generated file is not shown as expected (See attached expected and current file)
There are a lot of space characters before and after the expected text.
With Aspose.slides.2.9.1 the text is set correct.
Could you please help?
Is there a defect?
Hi Christof,
byte[] presentationAsByte=org.apache.commons.io.FileUtils.readFileToByteArray(new File (path+“pptx-expected.pptx”));ByteArrayInputStream presentationAsStream = new ByteArrayInputStream(presentationAsByte);PresentationEx presentationSrc = new PresentationEx(presentationAsStream);presentationSrc.save(path+“pptx-expected2.pptx”, com.aspose.slides.export .SaveFormat.PPTX);
Hi Mudassir,
thanks for quick reply.
These both files attached by me, were only different outputs.
But I can reproduce it also with the file “pptx-expected.pptx”.
For this purpose you need to reopen/reinitalize the file “pptx-expected2.pptx”:
byte[] presentationAsByte=org.apache.commons.io.FileUtils.readFileToByteArray(new File (path+“pptx-expected.pptx”));ByteArrayInputStream presentationAsStream = new ByteArrayInputStream(presentationAsByte);PresentationEx presentationSrc = new PresentationEx(presentationAsStream);presentationSrc.save(path+“pptx-expected2.pptx”, com.aspose.slides.export .SaveFormat.PPTX);byte[] presentationAsByte2=org.apache.commons.io.FileUtils.readFileToByteArray(new File (path+“pptx-expected2.pptx”));ByteArrayInputStream presentationAsStream2 = new ByteArrayInputStream(presentationAsByte2);PresentationEx presentationSrc2 = new PresentationEx(presentationAsStream2);presentationSrc2.save(path+“pptx-expected3.pptx”, com.aspose.slides.export .SaveFormat.PPTX);
We don’t save a file in the filesystem and reopen it again,
but we create and save a pptx file as byte[] in the database.
On demand we take the byte[] from database and create the requested pptx report.
It makes no difference, if the byte[] for input stream comes from a filesystem or database.
Since Aspose Slides 2.9.2 this doesn’t work anymore.
Could you please check it?
Thanks for your help!
Christof
Hi Christof,
I would be very interested in a fix for this problem, since I am facing the same:
1. I read in a PresentationEx from file
2. I do some adjustments to the presentation
3. I save the presentation to the same file path
4. Later, when I reopen the presentation and again read it into PresentationEx, I get random leading and trailing blank spaces inside of my PortionEx text. I don’t get this behaviour for any PortionExs I added to the presentation while step 4 - only for those that already existed.
I checked the file on the filesystem, the source seems to be ok. The XML does not contain any blanks - not before and after saving for the first time (steps 1-3). It doesn’t matter whether I create a PresentationEx object from stream of from path (as String), neither does using either the save or write method to save my changes back to the file.
Oh yes, I am using Aspose.Slides for Java 2.9.4.
Hi
Christina,
Hey Mudassir,
thanks for your reply. I retried with Aspose.Slides 2.9.5 and still get the same error. Attached you can find my (very basic) presentation.
Here my code snippet, also very basic. I just open the presentation and save it. Then I wait for 10 seconds. Then I reopen the same file source and save it:
private static final String REPORTTEMPLATES_COPY_PPTX = “C:\office_aspose\Presentation1.pptx”;
public static void main(String[] args) {
insertLicence();
try {
PresentationEx presentation = new PresentationEx(REPORTTEMPLATES_COPY_PPTX);
presentation.write(REPORTTEMPLATES_COPY_PPTX);
presentation = null;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
Thread.sleep(10000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
try {
PresentationEx presentationAgain = new PresentationEx(REPORTTEMPLATES_COPY_PPTX);
presentationAgain.write(REPORTTEMPLATES_COPY_PPTX);
} catch (Exception e) {
e.printStackTrace();
}
}</code><br><br>Debugging the presentation-Object with<br>((com.aspose.slides.pptx.AutoShapeEx)presentation.getSlides().get(0).getShapes().get(0)).getTextFrame().getParagraphs().get(0).getText()<br>I get:<br>(java.lang.String) Halloo<br>No unwanted blank spaces there.<br><br>Debugging the presentationAgain-object with <br>((com.aspose.slides.pptx.AutoShapeEx)presentationAgain.getSlides().get(0).getShapes().get(0)).getTextFrame().getParagraphs().get(0).getText()<br>I get:<br>(java.lang.String) Halloo (End here)<br>Also, unzipping the PPTX and having alook into the slide1.xml after saving the second time also shows that blank spaces have been added.<br>
Hi Christina,
We are sorry for your inconvenience,
Hey Mudassir,
are there by any chance news on this topic? I used a testing licence in July to find out whether Aspose.Slides is meeting with our requirements, then stopped evaluating because of this bug. Now that the topic becomes more time-critical to us, I tried again with Aspose.Slides for Java 2.9.6 - to face even worse errors. (Simple setting of text on a newly created paragraphEx did not work and failed with NullpointerExceptions.)
I switched back to 2.9.5, but this issue of leading and trailing blank spaces is unfortunately a show-stopper. (Fixing it by traversing all text in a presentation to call trim() before saving the file does not seem very desirable :-))
Would be glad for an update.
Hi Christof,
Hey Mudassir,
that’s great news - thanks a bunch! Looking forward to the new version and will test it as soon as it is released.
Hey Mudassir,
all problems solved with 3.0.0 - thanks a bunch!
Hi Christof,
The issues you have found earlier (filed as SLIDESJAVA-33427) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)
The issues you have found earlier (filed as SLIDESJAVA-33386) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.