We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ISlides Insert() not working as expected

Hello,

I am attempting to use ISlides Insert() per

http://help.syncfusion.com/cr/cref_files/wpf/presentation/Syncfusion.Presentation.Base~Syncfusion.Presentation.ISlides~Insert.html

I am using an existing presentation (.pptx) file and cloning a desired slide via Clone().  After saving the presentation and loading it in PowerPoint, PowerPoint informs me that the file is corrupted and offers to repair it.

Am I using Insert() correctly?

Thank you.


Snippet:

using (IPresentation presentation = Presentation.Open(@"template v2.pptx"))
{
ISlide slideModels = presentation.Slides[3];
ISlide slideModels_clone = slideModels.Clone();

presentation.Slides.Insert(2, slideModels_clone);

presentation.Save(outputPath);                

presentation.Close();
}

3 Replies

DJ Devisri Jothi Syncfusion Team March 1, 2017 05:06 AM UTC

Hi Brian, 
Thank you for contacting Syncfusion support. 
Am I using Insert() correctly? 
Yes, we checked the provided code snippet and it is the correct way to insert slide in any presentation. 
Sample 
We have created a sample that loads a PowerPoint presentation and inserts a cloned slide at specific index in the slide collection. On saving the presentation, the resultant file is not corrupted as reported.  
You may download the sample from the below link, 
We suspect that a specific content in the slide of the template used at your end corrupts the resultant presentation while preforming insert operation to the cloned slide.  
Could you please provide us your input template so that it will be helpful for us to proceed further with this? 
Regards, 
Devisri. 



BB Brian B March 1, 2017 04:55 PM UTC

Hi, Devisri,

Thanks for your prompt reply & assistance.

I was able to successfully use Insert() with the EssentialPresentation.pptx that you supplied, and noted that it was created with Office 365 (internally v. 16.x).  I was also able to create a new .pptx using Office 2013, read it, clone a slide, insert it into the presentation, save the presentation, and read it successfully using Office 2013.

http://superuser.com/questions/664355/which-version-of-powerpoint-was-used-to-create-a-document and http://portal.presentationpro.com/kb/a192/how-do-i-tell-what-version-office-powerpoint-my-computer.aspx were useful in determining internal version numbers of the .pptx files with which I'm working.

I have only Office 2013 (internally version 15.x) and that is also the version used to create the attached AnonymizedOffice2013Template.pptx.

So, it appears you supposition about the possibility of content inside the template .pptx is likely correct.  Can you examine AnonymizedOffice2013Template.pptx and/or work with it to reproduce what I'm seeing?


Thank you,
Brian

Attachment: AnonymizedOffice2013Template_f11eeec0.zip


DJ Devisri Jothi Syncfusion Team March 2, 2017 06:03 AM UTC

Hi Brian, 
Thank you for your update. 
We checked the provided PowerPoint presentation – “AnonymizedOffice2013Template.pptx”. We are able to reproduce the scenario “Output presentation gets corrupted while inserting a cloned slide to a template”
A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates 
Please let me know if you have any question.  
Regards, 
Devisri 


Loader.
Up arrow icon