Problem with a new PresentationEx initialized by a input stream

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,


I have used the following code snippet using Aspose.Slides for Java 2.9.4 and have not been able to obtain any issue while saving the presentation. For your kind reference, I have also attached the generated presentation. Can you please share that whether you are modifying the presentations or just accessing and saving that.

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);

Many Thanks,

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 have worked with the code snippet shared by you and this time I have been able to observe the issue specified. An issue with ID SLIDESJAVA-33386 has been created in our issue tracking system to further investigate and resolve the issue. We will share the further information with you as soon as it will be shared by our development team.

We are sorry for your inconvenience,

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,


I have observed the issue shared by you. Can you please share the sample presentation along with the code snippet you are using. Please also share the generated corrupted output by highlighting the issue. Please also try using Aspose.Slides for Java 2.9.5 as well before sharing the requested data with us. I will investigate the issue further on my end to help you out further.

Many Thanks,

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,


Thanks for sharing the requested information.

I have worked with the presentation file shared by you using provided code snippet and have been able to reproduce the issue specified. An issue with ID SLIDESJAVA-33427 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 resolved.

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,


I have verified your both issues with upcoming version of Aspose.Slides for Java 3.0.0 and feel happy to share that both of the issues have been found resolved in that. We are planing to share the new product version by mid of coming week. You may use the specified product version as per your convenience as soon as it will be available.

Many Thanks,

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,


You are always welcome. Please share if I may help you further in this regard.

Many Thanks,

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.