Skip to content

Commit

Permalink
Merge pull request #56 from snehasf3509/master
Browse files Browse the repository at this point in the history
Sample to merge PowerPoint slide with Source formatting
  • Loading branch information
MohanaselvamJothi authored May 2, 2024
2 parents 0af24ab + de72953 commit f980bea
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge-PowerPoint-slide-with-Source-formatting", "Merge-PowerPoint-slide-with-Source-formatting\Merge-PowerPoint-slide-with-Source-formatting.csproj", "{200E55BD-87C8-4D42-A14E-290C0AB1EF00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5944F990-AC83-4E81-AEB9-28E7F2EE876D}
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Merge_PowerPoint_slide_with_Source_formatting</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Syncfusion.Presentation;

//Load or open an PowerPoint Presentation.
using FileStream sourcePresentationStream = new(Path.GetFullPath(@"../../../Data/SourcePresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using FileStream destinationPresentationStream = new(Path.GetFullPath(@"../../../Data/DestinationPresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
//Open an existing PowerPoint presentation.
using IPresentation sourcePresentation = Presentation.Open(sourcePresentationStream);
//Open the destination Presentation.
using IPresentation destinationPresentation = Presentation.Open(destinationPresentationStream);
//Clone the first slide of the source Presentation.
ISlide clonedSlide = sourcePresentation.Slides[0].Clone();
//Merge the cloned slide to the destination Presentation with paste option - Destination Theme.
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.SourceFormatting);
using FileStream outputStream = new(Path.GetFullPath(@"../../../Result.pptx"), FileMode.Create, FileAccess.ReadWrite);
destinationPresentation.Save(outputStream);

0 comments on commit f980bea

Please sign in to comment.