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

Free Support Forum - aspose.com

Merge of pptx

I need help in mergin of pptx using Apose.slide.
I have downloaded the evaluation versionof 17.6 (zip file from https://downloads.aspose.com/slides/java/new-releases/aspose.slides-for-java-17.6/
I am using below code from one of e forums here
However the classes like PresentationEx , SlidesEx cannot be fouind.
Can you send me the exact code with main program and tell me the exact jar or the maven dependency you are using.
Below code doesnt compile. Teere are different APIs that I see in the editor
May be I am doing some small mistake.
Any help would be appreciated

public static PresentationEx PresentationClone(PresentationEx SourcePres,PresentationEx TargetPres)


//Getting Slide and Master Collection for Target presentation

SlidesEx TargetSlides=TargetPres.getSlides();

SlideEx slide=null;

SlideEx clonedSlide=null;

NotesSlideEx notes=null;

NotesSlideEx ClonedSlideNotes=null;

int iClonedIndex=-1;

for(int i=0;i<SourcePres.getSlides().size();i++)






//Copying Slide notes


if(notes!=null && notes.getShapes().size()>0)







ShapeEx shape=null;

for(int j=0;j<notes.getShapes().size();j++)



if(shape instanceof AutoShapeEx)


TextFrameEx txtFrame=((AutoShapeEx)shape).getTextFrame();

if (txtFrame!=null && txtFrame.getText()!="")


ShapeEx temShape=ClonedSlideNotes.getShapes().get(j);

AutoShapeEx aShp=(AutoShapeEx)temShape;








return TargetPres;



I have observed the sample code shared by you. Actually, you are using legacy code that is no longer supported in API. I suggest you to please visit this documentation link for cloning slide from source to target presentation. I have also observed that you have used Autoshape in your sample code as well. Please visit this documentation link for adding text frame on slide. I hope the shared information will be helpful.

Many Thanks,

Mudassir Fayyaz

Thanks Mudassir. It helped solve my issue.
However I find that it takes lot of time for reading and writing a pptx.
The internal operations are however faster.
Here are some statistics for a simple program that reads a pptx with a single row inside it and updates it values and saves it to a different pptx.

Total time(in ms) taken to read a file :9564
Total time(in ms) taken to write a file :7588
Total time(in ms) taken for complete program: 17157
Total time(in ms) taken for operations other than read and write file: 5

Its seen that major time is gone in read and write of presentation.
Is it a limitation of evaluation version or is there any way to speed it up.


Its good to know that things are working on your end now. As far as issue related to time consumed while reading presentation files is concerned, I like to share that legacy API had different namespaces for dealing with PPT and PPTX file formats. In new unified API, we have single namespace for dealing with all form of applications. Moreover, many new features and classes have been included in DOM (Document Object Model) of Aspose.Slides which also impacts the loading time of presentation to an extent. Overall, the presentation loading and processing time depends on many factors including presentation size, number of slides, number of shapes inside slide and multi media content inside slide. I hope the share elaboration will be helpful in understanding the reason.

So this can be called as a limitation to confirm right?
Also I had just read a pptx with one slide inside it updated the row contents and saved it into another file.
Not sure how will it behave for large number of slides


I request you to please share the working sample project along with source presentation files. Please also share the machine and Operating System details used on your end along with statistics achieved. We will be able to investigate the issue on provision of requested information and will then share further feedback with you.

Please find below code.
Its a plain java program with just one class and main method.
Also attaching the screenshot of the slide that my pptx doc contains.

template.PNG (61.6 KB)

package com.demo.documentgeneration.aspose;

import com.aspose.slides.*;

public class AsposeCreatePPTFromTemplate {
public static void main(String args[]) {
long startTime = System.currentTimeMillis();
String dataDir =“C:\presentation\delete\Aspose\”;
long readStartTime = System.currentTimeMillis();
Presentation pres = new Presentation(dataDir+“template.pptx”);
long readEndTime = System.currentTimeMillis();
System.out.println(“Total time(in ms) taken to read a file :”+ (readEndTime-readStartTime));

// Access the first slide
ISlide sld = pres.getSlides().get_Item(0);

// Initialize null TableEx
ITable tbl = null;

// Iterate through the shapes and set a reference to the table found
for (IShape shp : sld.getShapes())
if (shp instanceof ITable)
tbl = (ITable) shp;

IRow headerRow = tbl.getRows().get_Item(0);
IRow row1 = tbl.getRows().get_Item(1);
int i=0;
for(ICell cell : headerRow) {
// Save the PPTX to Disk
long writeStartTime = System.currentTimeMillis();
pres.save(dataDir+“generated.pptx”, SaveFormat.Pptx);
long writeEndTime = System.currentTimeMillis();
System.out.println(“Total time(in ms) taken to write a file :”+ (writeEndTime-writeStartTime));
long endTime = System.currentTimeMillis();
System.out.println("Total time(in ms) taken for complete program: "+ (endTime-startTime));
System.out.println("Total time(in ms) taken for operations other than read and write file: "+ ((endTime-startTime)-(writeEndTime-writeStartTime)-(readEndTime-readStartTime)));



Machine Config:
Windows 7 Enterprise , Service Pack 1
Processor: Intel Core i5-5300U CPU, 2.30GHz
120GB Hard Disc storage
64 bit OS

Powerpoint Version: 14.0.7182.5000 (32 bit)
Part of Microsoft Office Professional Plus 2010


I have observed your comments. Can you please share sample presentation so that we may further investigate to help you out.

template.zip (32.1 KB)


Any updates?


I have worked with presentation file and source code shared by you using Aspose.Slides for Java 17.6 and have been able to observe the issue. A ticket with ID SLIDESJAVA-36495 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

We are sorry for your inconvenience,

Thanks, can you please take this on priority as we need to decide on purchasing of the license ASAP.
Since it is related to performance it is a critical deciding factor


I have observed your comments. Actually issue has been added recently in our issue tracking system and our product team is investigating issue in details.I have also increased issue priority from medium to high. I request for your patience till the time further feedback is shared by our product team and issue gets resolved.

We are sorry for your inconvenience,

Thanks, any estimated time for accomplishment?


Our product team investigated issue in details and i like to share their findings with you. The problem you are facing is caused by JVM’s warmpup: the time it takes for the JVM to find the hotspots and JIT these sections of the code. Our product team did not find any problem with presentation file. Java performs the first run is always slower than the subsequent load/read operations which are in fact heavy operations for any program.

Thanks, but if I read write a file through plain java libraries like FileInputStream etc it doesnt take so much time.
10 seconds to load a document is too much.
It should be agreed. Let me know if you think otherwise and if anything can be done in your product to improve performance or does any previous version of aspose.slides work faster


I have discussed this with our product team and like to share that Aspose.Slides for Java is ported from Aspose.Slides for .NET. This poses some limitations on API and first iteration of loading the presentation is going to take more time. However, the subsequent loading of the presentation instances shall take lesser time as all static data for the presentation gets already initialized during first pass that took more time. This is architecture implementation limitation. Moreover, in future we are going to provide support for partial load of presentation as well that may help you in solving the issue.

Thanks for the update