Skip to content

Commit ad3e819

Browse files
author
snehasf3509
authored
Update Working-with-Slide.md
1 parent 5e37d28 commit ad3e819

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

File-Formats/Presentation/Working-with-Slide.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,11 @@ You can download a complete working sample from [GitHub](https://github.com/Sync
451451

452452
The Essential Presentation provides ability to clone slides from one Presentation to another Presentation. With this ability, you can split a large Presentation into small ones and also merge multiple presentations to one Presentation. You can choose the theme for the cloned slide by using the enum [PasteOption](https://help.syncfusion.com/cr/file-formats/Syncfusion.Presentation.PasteOptions.html).
453453

454+
### Destination formatting
455+
This [PasteOption](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.PasteOptions.html) preserves the merged slide with formatting from the destination file during merging.
456+
457+
The following code sample explains how to merge slide with the destination formatting.
458+
454459
{% tabs %}
455460

456461
{% highlight c# tabtitle="C# [Cross-platform]" %}
@@ -511,6 +516,71 @@ destinationPresentation.Close()
511516

512517
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Slides/Merge-PowerPoint-slide).
513518

519+
### Source formatting
520+
This [PasteOption](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.PasteOptions.html) preserves the merged slide with formatting from the source file during merging.
521+
522+
The following code sample explains how to merge slide with the source formatting.
523+
524+
{% tabs %}
525+
526+
{% highlight c# tabtitle="C# [Cross-platform]" %}
527+
//Opens the source Presentation
528+
IPresentation sourcePresentation = Presentation.Open(SourcePresentationStream);
529+
//Opens the destination Presentation
530+
IPresentation destinationPresentation = Presentation.Open(destinationPresentationStream);
531+
//Clones the first slide of the source Presentation
532+
ISlide clonedSlide = sourcePresentation.Slides[0].Clone();
533+
//Merges the cloned slide to the destination Presentation with paste option - Source formatting
534+
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.SourceFormatting);
535+
//Save the PowerPoint Presentation as stream
536+
FileStream outputStream = new FileStream(OutputFileName, FileMode.Create);
537+
destinationPresentation.Save(outputStream);
538+
//Release all resources of the stream
539+
outputStream.Dispose();
540+
//Closes the source presentation
541+
sourcePresentation.Close();
542+
//Closes the destination Presentation
543+
destinationPresentation.Close();
544+
{% endhighlight %}
545+
546+
{% highlight c# tabtitle="C# [Windows-specific]" %}
547+
//Opens the source Presentation
548+
IPresentation sourcePresentation = Presentation.Open("SourcePresentation.pptx");
549+
//Opens the destination Presentation
550+
IPresentation destinationPresentation = Presentation.Open("DestinationPresentation.pptx");
551+
//Clones the first slide of the source Presentation
552+
ISlide clonedSlide = sourcePresentation.Slides[0].Clone();
553+
//Merges the cloned slide to the destination Presentation with paste option - Source formatting
554+
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.SourceFormatting);
555+
//Saves the destination Presentation
556+
destinationPresentation.Save("Output.pptx");
557+
//Closes the source presentation
558+
sourcePresentation.Close();
559+
//Closes the destination Presentation
560+
destinationPresentation.Close();
561+
{% endhighlight %}
562+
563+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
564+
'Opens the source Presentation
565+
Dim sourcePresentation_1 As IPresentation = Presentation.Open("SourcePresentation.pptx")
566+
'Opens the destination Presentation
567+
Dim destinationPresentation_1 As IPresentation = Presentation.Open("DestinationPresentation.pptx")
568+
'Clones the first slide of the source Presentation
569+
Dim clonedSlide As ISlide = sourcePresentation_1.Slides(0).Clone()
570+
'Merges the cloned slide to the destination Presentation with paste option - Source formatting
571+
destinationPresentation_1.Slides.Add(clonedSlide, PasteOptions.SourceFormatting)
572+
'Saves the destination Presentation
573+
destinationPresentation_1.Save("Output.pptx")
574+
'Closes the source presentation
575+
sourcePresentation.Close()
576+
'Closes the destination Presentation
577+
destinationPresentation.Close()
578+
{% endhighlight %}
579+
580+
{% endtabs %}
581+
582+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Slides/Merge-PowerPoint-slide-with-Source-formatting/.NET).
583+
514584
## Removing slide
515585

516586
The Essential Presentation provides the ability to delete a slide by its instance or by its index position in slide collection. The following code demonstrates how to delete a slide from a presentation. 
@@ -687,4 +757,4 @@ pptxDoc.Close()
687757

688758
{% endtabs %}
689759

690-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Slides/Change-PowerPoint-slide-background).
760+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Slides/Change-PowerPoint-slide-background).

0 commit comments

Comments
 (0)