Skip to content

Commit 6209edf

Browse files
Merge pull request #99 from Suriya-Balamurugan/master
Added README files for Presentation interactive sample browser
2 parents 1ade30f + 5abbda7 commit 6209edf

File tree

22 files changed

+656
-6
lines changed

22 files changed

+656
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Add animation to a PowerPoint Presentation using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, and edit PowerPoint files programmatically without Microsoft office or interop dependencies. Using this library, you can **add animation to a PowerPoint Presentation** using C#.
4+
5+
## Steps to add animation programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using System.IO;
16+
```
17+
18+
Step 4: Add the following code snippet in Program.cs file to add animations to the PowerPoint Presentation.
19+
20+
```csharp
21+
//Load or open an PowerPoint Presentation.
22+
using IPresentation pptxDoc = Presentation.Create();
23+
//Add a blank slide to Presentation.
24+
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
25+
//Add normal shape to slide.
26+
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 100, 100, 300, 300);
27+
//Access the animation sequence to create effects.
28+
ISequence sequence = slide.Timeline.MainSequence;
29+
//Add bounce effect to the shape.
30+
IEffect bounceEffect = sequence.AddEffect(cubeShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.OnClick);
31+
using FileStream outputStream = new(Path.GetFullPath(@"Output/Output.pptx"), FileMode.Create, FileAccess.ReadWrite);
32+
pptxDoc.Save(outputStream);
33+
```
34+
35+
More information about adding animations can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/working-with-animation) section.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Add a chart to a PowerPoint Presentation using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, and edit PowerPoint files programmatically without Microsoft Office or interop dependencies. Using this library, you can **add a chart to a PowerPoint Presentation** using C#.
4+
5+
## Steps to add a chart programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using Syncfusion.OfficeChart;
16+
using System.IO;
17+
```
18+
19+
Step 4: Add the following code snippet in Program.cs file to add a chart to the PowerPoint Presentation.
20+
21+
```csharp
22+
//Load or open an PowerPoint Presentation.
23+
using IPresentation pptxDoc = Presentation.Create();
24+
//Adds a blank slide to the Presentation.
25+
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
26+
//Add chart to the slide with position and size.
27+
28+
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
29+
//Specify the chart title.
30+
chart.ChartTitle = "Sales Analysis";
31+
//Set chart data - Row1.
32+
chart.ChartData.SetValue(1, 2, "Jan");
33+
chart.ChartData.SetValue(1, 3, "Feb");
34+
chart.ChartData.SetValue(1, 4, "March");
35+
36+
//Set chart data - Row2.
37+
chart.ChartData.SetValue(2, 1, 2010);
38+
chart.ChartData.SetValue(2, 2, 60);
39+
chart.ChartData.SetValue(2, 3, 70);
40+
chart.ChartData.SetValue(2, 4, 80);
41+
42+
//Set chart data - Row3.
43+
chart.ChartData.SetValue(3, 1, 2011);
44+
chart.ChartData.SetValue(3, 2, 80);
45+
chart.ChartData.SetValue(3, 3, 70);
46+
chart.ChartData.SetValue(3, 4, 60);
47+
48+
//Set chart data - Row4.
49+
chart.ChartData.SetValue(4, 1, 2012);
50+
chart.ChartData.SetValue(4, 2, 60);
51+
chart.ChartData.SetValue(4, 3, 70);
52+
chart.ChartData.SetValue(4, 4, 80);
53+
54+
//Create a new chart series with the name.
55+
IOfficeChartSerie seriesJan = chart.Series.Add("Jan");
56+
//Set the data range of chart series – start row, start column, end row, end column.
57+
seriesJan.Values = chart.ChartData[2, 2, 4, 2];
58+
//Create a new chart series with the name.
59+
IOfficeChartSerie seriesFeb = chart.Series.Add("Feb");
60+
//Set the data range of chart series – start row, start column, end row, end column.
61+
seriesFeb.Values = chart.ChartData[2, 3, 4, 3];
62+
//Create a new chart series with the name.
63+
IOfficeChartSerie seriesMarch = chart.Series.Add("March");
64+
//Set the data range of chart series – start row, start column, end row, end column.
65+
seriesMarch.Values = chart.ChartData[2, 4, 4, 4];
66+
//Set the data range of the category axis.
67+
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
68+
//Specify the chart type.
69+
chart.ChartType = OfficeChartType.Column_Clustered;
70+
using FileStream outputStream = new(Path.GetFullPath(@"Output/Output.pptx"), FileMode.Create, FileAccess.ReadWrite);
71+
pptxDoc.Save(outputStream);
72+
```
73+
74+
More information about adding charts can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/working-with-charts) section.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Find and replace text in a PowerPoint Presentation using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, and edit PowerPoint files programmatically without Microsoft Office or interop dependencies. Using this library, you can **find and replace text in a PowerPoint Presentation** using C#.
4+
5+
## Steps to find and replace text programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using System.IO;
16+
```
17+
18+
Step 4: Add the following code snippet in Program.cs file to find and replace text in the PowerPoint Presentation.
19+
20+
```csharp
21+
//Load or open an PowerPoint Presentation.
22+
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
23+
//Open an existing PowerPoint presentation.
24+
using IPresentation pptxDoc = Presentation.Open(inputStream);
25+
//Find all the occurrences of a particular text in the PowerPoint presentation.
26+
ITextSelection[] textSelections = pptxDoc.FindAll("product", false, false);
27+
foreach (ITextSelection textSelection in textSelections)
28+
{
29+
//Get the found text as a single text part.
30+
ITextPart textPart = textSelection.GetAsOneTextPart();
31+
//Replace the text.
32+
textPart.Text = "Service";
33+
}
34+
using FileStream outputStream = new(Path.GetFullPath(@"Output/Output.pptx"), FileMode.Create, FileAccess.ReadWrite);
35+
pptxDoc.Save(outputStream);
36+
```
37+
38+
More information about find and replace can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/working-with-find-and-replace) section.

PPTX-to-Image-conversion/Convert-PowerPoint-slide-to-Image/.NET/Convert-PowerPoint-slide-to-Image/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
pptxDoc.PresentationRenderer = new PresentationRenderer();
1010
//Convert PowerPoint slide to image as stream.
1111
using Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg);
12-
//Reset the stream position.
13-
stream.Position = 0;
1412
//Create the output image file stream.
1513
using FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/Output.jpg"));
1614
//Copy the converted image stream into created output stream.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Convert PowerPoint Presentation to Image using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, edit, and convert PowerPoint files programmatically without Microsoft office or interop dependencies. Using this library, you can **convert a PowerPoint Presentation to Image** using C#.
4+
5+
## Steps to convert PPTX to Image programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using Syncfusion.PresentationRenderer;
16+
using System.IO;
17+
```
18+
19+
Step 4: Add the following code snippet in Program.cs file to convert a PowerPoint Presentation to image.
20+
21+
```csharp
22+
//Load or open an PowerPoint Presentation.
23+
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
24+
//Open an existing PowerPoint presentation.
25+
using IPresentation pptxDoc = Presentation.Open(inputStream);
26+
//Initialize the PresentationRenderer to perform image conversion.
27+
pptxDoc.PresentationRenderer = new PresentationRenderer();
28+
//Convert PowerPoint slide to image as stream.
29+
using Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg);
30+
//Create the output image file stream.
31+
using FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/Output.jpg"));
32+
//Copy the converted image stream into created output stream.
33+
stream.CopyTo(fileStreamOutput);
34+
```
35+
36+
More information about PPTX to Image conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/presentation-to-image) section.

PPTX-to-PDF-conversion/Convert-PowerPoint-into-accessible-PDF/.NET/Convert-PowerPoint-into-accessible-PDF/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
pdfConverterSettings.AutoTag = true;
1313
//Convert the PowerPoint document to a PDF document.
1414
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
15-
//Save the converted PDF document to the fileStream.
16-
using FileStream fileStreamOutput = File.Create(Path.GetFullPath("Output/PPTXToPDF.pdf"));
17-
pdfDocument.Save(fileStreamOutput);
18-
fileStreamOutput.Position = 0;
15+
//Create new instance of file stream.
16+
using FileStream fileStreamOutput = new(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create);
17+
//Save the generated PDF to file stream.
18+
pdfDocument.Save(fileStreamOutput);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Convert PowerPoint Presentation to PDF/UA using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, edit, and convert PowerPoint files programmatically without Microsoft office or interop dependencies. Using this library, you can **convert a PowerPoint Presentation to PDF/UA** using C#.
4+
5+
## Steps to convert PPTX to PDF/UA programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using Syncfusion.PresentationRenderer;
16+
using Syncfusion.Pdf;
17+
using System.IO;
18+
```
19+
20+
Step 4: Add the following code snippet in Program.cs file to convert a PowerPoint Presentation to PDF/UA.
21+
22+
```csharp
23+
//Load the PowerPoint presentation into a stream.
24+
using FileStream fileStreamInput = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
25+
//Open the existing PowerPoint presentation with the loaded stream.
26+
using IPresentation pptxDoc = Presentation.Open(fileStreamInput) ;
27+
//Instantiation of the PresentationToPdfConverterSettings.
28+
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
29+
//Enable a flag to preserve structured document tags in the converted PDF document.
30+
pdfConverterSettings.AutoTag = true;
31+
//Convert the PowerPoint document to a PDF document.
32+
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
33+
//Create new instance of file stream.
34+
using FileStream fileStreamOutput = new(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create);
35+
//Save the generated PDF to file stream.
36+
pdfDocument.Save(fileStreamOutput);
37+
```
38+
39+
More information about PPTX to PDF/UA conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf#accessible-pdf-document) section.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Convert PowerPoint Presentation to PDF using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, edit, and convert PowerPoint files programmatically without Microsoft office or interop dependencies. Using this library, you can **convert a PowerPoint Presentation to PDF** using C#.
4+
5+
## Steps to convert PPTX to PDF programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using Syncfusion.PresentationRenderer;
16+
using Syncfusion.Pdf;
17+
using System.IO;
18+
```
19+
20+
Step 4: Add the following code snippet in Program.cs file to convert a PowerPoint Presentation to PDF.
21+
22+
```csharp
23+
//Open the PowerPoint file stream.
24+
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
25+
{
26+
//Load an existing PowerPoint Presentation.
27+
using (IPresentation pptxDoc = Presentation.Open(fileStream))
28+
{
29+
//Convert PowerPoint into PDF document.
30+
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
31+
{
32+
//Save the PDF file to file system.
33+
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
34+
{
35+
pdfDocument.Save(outputStream);
36+
}
37+
}
38+
}
39+
}
40+
```
41+
42+
More information about PPTX to PDF conversion can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf) section.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Convert PowerPoint Presentation to PDF/A using C#
2+
3+
The Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-processing/powerpoint-framework/net/powerpoint-library) (Presentation) enables you to create, read, edit, and convert PowerPoint files programmatically without Microsoft office or interop dependencies. Using this library, you can **convert a PowerPoint Presentation to PDF/A** using C#.
4+
5+
## Steps to convert PPTX to PDF/A programmatically
6+
7+
Step 1: Create a new .NET Core console application project.
8+
9+
Step 2: Install the [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).
10+
11+
Step 3: Include the following namespaces in the Program.cs file.
12+
13+
```csharp
14+
using Syncfusion.Presentation;
15+
using Syncfusion.PresentationRenderer;
16+
using Syncfusion.Pdf;
17+
using System.IO;
18+
```
19+
20+
Step 4: Add the following code snippet in Program.cs file to convert a PowerPoint Presentation to PDF/A.
21+
22+
```csharp
23+
//Create a file stream to read the PowerPoint presentation file.
24+
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
25+
//Open an existing PowerPoint presentation.
26+
using IPresentation pptxDoc = Presentation.Open(inputStream);
27+
//Initialize the conversion settings.
28+
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
29+
//Set the Pdf conformance level to A1B
30+
pdfConverterSettings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
31+
//Convert the PowerPoint presentation to PDF file.
32+
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
33+
//Create new instance of file stream.
34+
using FileStream pdfStream = new(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create);
35+
//Save the generated PDF to file stream.
36+
pdfDocument.Save(pdfStream);
37+
```
38+
39+
More information about converting PPTX to PDF with conformance can be found in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf#pdf-conformance) section.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35327.3
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge-two-presentations", "Merge-two-presentations\Merge-two-presentations.csproj", "{C6039BBA-48D0-4E1F-BD63-466AE4C60704}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C6039BBA-48D0-4E1F-BD63-466AE4C60704}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {088F677A-7D77-4D4D-901D-FC77679F7DC7}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Merge_two_presentations</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Presentation.NET" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\SourcePresentation.pptx">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Data\DestinationPresentation.pptx">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
<None Update="Output\.gitkeep">
23+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
</None>
25+
</ItemGroup>
26+
27+
</Project>

PowerPoint-Presentation/Merge-two-presentations/.NET/Merge-two-presentations/Output/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)