Free Support Forum - aspose.com

Macros deactivated after loading and saving PPTM file (Java)

Hello,

I would like to report a bug detected during my work using Aspose, specifically the Slides module. I used the version 18.11.

My work required me to use Aspose.Slides to load a pptm file, modify it, and save this modified file elsewhere. All of this was done using Java.

The original file contained a macro designed to mark each page of the file with “Page X of Y” with X and Y being the appropriate values. The macro was called every time the file was saved.

However, upon testing, the modified file no longer had the macro active.

After investigating the issue, I found that its source was that when my code opened the source file to create an object com.aspose.slides.Presentation, it removed the reference to the macro in the .rels file (found in the _rels directory of the pptm file).

The workaround I found was to unzip the generated powerpoint file, replace the .rels file with a correct version stored locally, then zip the folder back to a powerpoint file and use that one instead.

That method worked and allowed me to complete my assignment, but it did take a long time to isolate and solve the issue.

Regards,

Julien Armand

@JulienARMAND26,

Can you please share source file and sample project so that we may further investigate to help you out.

Hello,

Sorry for the long delay before my answer.
Here is the PPTM file used as source, as well as the java code which causes the loss of the macro updating the slide number (TestMacroLost.java) and the corrective we developed (TestMacroKept.java).
The file SourceRels (which is the .rels file of TestLossMacro.pptm) is necessary to the fix, as it replaces the one created by Aspose during the reading/writing of the source PPTM file.

Regards,

Julien Armand

ReturnLossMacroJulienArmand.zip (40.6 KB)

@JulienARMAND26,

I have worked with source file and sample code shared by you and unable to observe any issue. As you already mentioned about Apsose.Slides java 18.11 you are using on your end. I suggest you to please use latest version 19.7 on your end and if there is still an issue than please share generated result as well so that we may further investigate to help you out.

Hello,

I have upgraded the version of Aspose.Slides I use to the latest version (19.10, with the jar aspose-slides-19.10-jdk16.jar) and the issue still presents itself.
Attached is the latest version of my testing code, adapted to use Aspose.Slides v19.10.
The file “resultsMacroLost.pptm” generated by the code of TestMacroLostV2.java does not execute the macro when saved : duplicated slides do not update the number of pages in the lower right corner.
The source is still the .rels file, which is modified by the passage through Aspose.Slides.
The file generated by TestMacroKeptV2, by comparison, does work properly.

I am using Eclipse to develop and test my code, with the compiler compliance level for JDK set at 1.6.

Am I doing something wrong, or should I keep using my workaround ?

Regards.

ReturnLossMacroJulienArmandV2.zip (40.4 KB)

@JulienARMAND26,

I have worked with source file and sample project shared by you using Aspose.Slides 19.10 and unable to observe the issue. Can you please share generated result and desired result with us along with complete environment details. Please check attachment.resultsMacroKept.zip (30.4 KB)

Hello,

The ppt file in your attachment doesn’t have a working macro when I opened it : duplicating a slide then saving the file did not automatically update the page number in the lower right corner.
Here is the result I desire to obtain, with the macro kept :ReturnMacroKept.zip (37.8 KB)

Regards.

@JulienARMAND26,

Can you please try to use latest version of Aspose.Slides 19.11 on your end. Also please share environment details with us for further investigation.