I am getting an error when merging two PPTX documents. The code is below
Aspose.Slides.Pptx.PresentationEx ppt1 = new Aspose.Slides.Pptx.PresentationEx(new StreamReader(fileName).BaseStream);
Aspose.Slides.Pptx.PresentationEx ppt2 = new Aspose.Slides.Pptx.PresentationEx(new StreamReader(fileName).BaseStream);
Aspose.Slides.Pptx.PresentationEx output = new Aspose.Slides.Pptx.PresentationEx();
Aspose.Slides.Pptx.SlidesEx slds = output.Slides;
for (int slides = 0; slides < ppt1.Slides.Count; slides++)
{
slds.AddClone(ppt1.Slides[slides]);
}
for (int slides = 0; slides < ppt2.Slides.Count; slides++)
{
slds.AddClone(ppt2.Slides[slides]);
}
output.Slides.RemoveAt(0);
output.Write(fileName.Replace(Path.GetFileNameWithoutExtension(fileName), Path.GetFileNameWithoutExtension(fileName) + "_output"));
The code works fine. However, when I open the output PPTX, I get an error saying that the file is corrupt (though when I choose to recover the file, it opens up fine). Is there anything that I am missing that can cause this issue?
This message was posted using Page2Forum from Cloning a Slide - Aspose.Slides for .NET
Hi Binu,
Thanks for your interest in Aspose.Slides.
The code snippet that you have shared is fine. In order to investigate the issue specified, please share the source presentation files with us, so that we may reproduce the issue and add that in our issue tracking system. Please also share that which product version of Aspose.Slides for .NET you are using along with PowerPoint version.
Thanks and Regards,
Hi Mudassir,
I have attached both the original and merged files. I am using Aspose.Slides version 4.4.0 (part of Aspose.Total evaluation version that I have downloaded).
Thanks
Binu
Hi Binu,
Please accept my apologies for the delayed response.
I have worked with the presentation file shared by you using Aspose.Slides for .NET 4.4.5 and have successfully cloned the slides in presentation. I have not observed any issue while opening the generated presentation in PowerPoint 2007. You may download the mentioned version of Aspose.Slides for .NET from here.
Thanks and Regards,
Hi Mudassir,
I am sorry but I have not been able to evaluate the changes as yet. I am still running our tests after getting a temporary license for the Aspose.Total suite. I suppose when we purchase the Aspose.Total suite, it will contain the latest version of all the components, right? If version 4.4.5 is able to merge the PPTs correctly as you mentioned, then I assume that the issue I faced had something to do with the 4.4.0 of Aspose.Slides that was contained in the Aspose.Total suite I downloaded for evaluation.
Thanks & Regards,
Binu
Dear Binu,
I am sorry, I have not verified it with the Aspose.Slides for .NET 4.4.0. I have used the latest available version to resolve the issue specified. Secondly, whenever, you will purchase Aspose.Total suite, you will be subscripted for one year to download the all latest available product release that are released during the one year tenure of subscription starting from date of purchase. I may still advise you to please verify the issue resolution with Aspose.Slides for .NET 4.4.5 before you make any decision. You may use evolutionary version. There is no difference of functionality between evolutionary and licensed versions. The only difference is the presence of watermark in evolutionary version presentations/images/PDFs.
Thanks and Regards,
Hi Mudassir,
I have downloaded version 4.4.5 of Aspose slides, but I am still getting the same error when I open the file (screenshot attached). I have verified from my colleagues that this is not a local issue with the office installation on my desktop.
Thanks & Regards
Binu
Hi Binu,
I have cloned the presentation using code snippet shared by you and have been able to generate and open the presentation successfully. I am using Aspose.Slides for .NET 4.4.5 and PowerPoint 2007 version 12.0.6425.1000. Can you please try opening the shared presentation.
Thanks and Regards,
Hi Mudassir,
I am able to open the presentation, but it has only two slides. What I was doing in my code is to merge the slide with itself and create a new one. The version of Powerpoint on my desktop is 12.0.6535.5002.
Regards
Binu
Hi Binu,
As you have mentioned that you have been able to open the presentation shared by me. The presentation has been generated by using code snippet and source presentation shared by you. In order to reproduce the issue shared by you, I will request you to please share the complete code snippet with all source presentations. I will try reproducing the issue and add that in our issue tracking system for further resolution.
We are sorry for your inconvenience,
Hi Mudassir,
The code snippet and the presentation that I shared are the same ones that I have been working with. The source PPTX has 2 slides in it. If you look at the code snippet, you will see that I am creating two PresentationEx objects referring to the same filename, and then merging the slides together to form a 3rd PPT. So when you run my code snippet and pass the path to the PPTX to it(fully qualified file path), it should ideally generate a PPTX that has 4 slides. i.e. the output PPTX will have twice the number of slides from what you started off with.
Please let me know if you need additional info
Thanks & Regards
Binu
Hi Binu,
I have worked in accordance with the scenario shared by you and have been able successfully able to open the generated presentation file PowerPoint 2007. For your kind reference, I have also shared the generated presentation. Can you please try opening the shared presentation in your machine. If it gets failed to open then we can deduce the result that there may be some inconsistency in Aspose.Slides for .NET for the version of PowerPoint that has been installed on your machine.
Thanks and Regards,
Hi Mudassir,
I am able to open the presentation without any issues. I will check what else could be causing the issue. Appreciate your patience and support in handling this issue.
Thanks & Regards
Binu