Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Option Explicit
On Error Resume Next

' --- Change this output path as you want ---
Dim outputPath
outputPath = "D:\Output.pptx"

' Create the COM object exposed by your .NET class
' ProgID must match the [ProgId] attribute in your C# class
Dim obj
Set obj = CreateObject("Create_PowerPoint_Presentation.Class1")

If Err.Number <> 0 Then
MsgBox "Failed to create COM object 'Create_PowerPoint_Presentation.Class1'." & vbCrLf & _
"Error " & Err.Number & ": " & Err.Description, vbCritical, "COM Error"
WScript.Quit 1
End If

' Call the method exposed by your class
obj.CreatePowerPointPresentation outputPath

If Err.Number <> 0 Then
MsgBox "Method call failed (CreatePowerPointPresentation)." & vbCrLf & _
"Error " & Err.Number & ": " & Err.Description, vbCritical, "Invoke Error"
WScript.Quit 2
End If

' Release the COM object
Set obj = Nothing

MsgBox "Success!" & vbCrLf & "Document created at:" & vbCrLf & outputPath, vbInformation, "Done"
25 changes: 25 additions & 0 deletions Getting-started/COM-Interop/Create-PowerPoint-Presentation.sln
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.14.37111.16 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-PowerPoint-Presentation", "Create-PowerPoint-Presentation\Create-PowerPoint-Presentation.csproj", "{CFC430EC-97EF-4726-A8FD-BFCABB3CADE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CFC430EC-97EF-4726-A8FD-BFCABB3CADE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CFC430EC-97EF-4726-A8FD-BFCABB3CADE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CFC430EC-97EF-4726-A8FD-BFCABB3CADE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CFC430EC-97EF-4726-A8FD-BFCABB3CADE8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8D140AA4-F442-49D5-A550-C311C5A0B72D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Syncfusion.Presentation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Create_PowerPoint_Presentation
{
[ComVisible(true)]
[Guid("6F6B4A3C-5C98-4D63-8C7A-5B2C0F1D9E11")] // Use a unique GUID
[ProgId("Create_PowerPoint_Presentation.Class1")] // Stable ProgID for VBScript
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class1
{
public void CreatePowerPointPresentation(string outputFilePath)
{
//Create a new instance of PowerPoint Presentation file
using (IPresentation pptxDoc = Presentation.Create())
{
//Add a new slide to file and apply background color
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.TitleOnly);
//Specify the fill type and fill color for the slide background
slide.Background.Fill.FillType = FillType.Solid;
slide.Background.Fill.SolidFill.Color = ColorObject.FromArgb(232, 241, 229);
//Add title content to the slide by accessing the title placeholder of the TitleOnly layout-slide
IShape titleShape = slide.Shapes[0] as IShape;
titleShape.TextBody.AddParagraph("Company History").HorizontalAlignment = HorizontalAlignmentType.Center;
//Add description content to the slide by adding a new TextBox
IShape descriptionShape = slide.AddTextBox(53.22, 141.73, 874.19, 77.70);
descriptionShape.TextBody.Text = "IMN Solutions PVT LTD is the software company, established in 1987, by George Milton. The company has been listed as the trusted partner for many high-profile organizations since 1988 and got awards for quality products from reputed organizations.";
//Add bullet points to the slide
IShape bulletPointsShape = slide.AddTextBox(53.22, 270, 437.90, 116.32);

//Add a paragraph for a bullet point
IParagraph firstPara = bulletPointsShape.TextBody.AddParagraph("The company acquired the MCY corporation for 20 billion dollars and became the top revenue maker for the year 2015.");

//Format how the bullets should be displayed
firstPara.ListFormat.Type = ListType.Bulleted;
firstPara.LeftIndent = 35;
firstPara.FirstLineIndent = -35;

// Add another paragraph for the next bullet point
IParagraph secondPara = bulletPointsShape.TextBody.AddParagraph("The company is participating in top open source projects in automation industry.");

//Format how the bullets should be displayed
secondPara.ListFormat.Type = ListType.Bulleted;
secondPara.LeftIndent = 35;
secondPara.FirstLineIndent = -35;

//Add an auto-shape to the slide
IShape stampShape = slide.Shapes.AddShape(AutoShapeType.Explosion1, 48.93, 430.71, 104.13, 80.54);

//Format the auto-shape color by setting the fill type and text
stampShape.Fill.FillType = FillType.None;
stampShape.TextBody.AddParagraph("IMN").HorizontalAlignment = HorizontalAlignmentType.Center;
//Save the PowerPoint Presentation
pptxDoc.Save(outputFilePath);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CFC430EC-97EF-4726-A8FD-BFCABB3CADE8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Create_PowerPoint_Presentation</RootNamespace>
<AssemblyName>Create-PowerPoint-Presentation</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Syncfusion.Compression.Base, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Compression.Base.33.1.44\lib\net462\Syncfusion.Compression.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Licensing, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Licensing.33.1.44\lib\net462\Syncfusion.Licensing.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.OfficeChart.Base, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.OfficeChart.Base.33.1.44\lib\net462\Syncfusion.OfficeChart.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Presentation.Base, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Presentation.WinForms.33.1.44\lib\net462\Syncfusion.Presentation.Base.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Create-PowerPoint-Presentation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Create-PowerPoint-Presentation")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cfc430ec-97ef-4726-a8fd-bfcabb3cade8")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Syncfusion.Compression.Base" version="33.1.44" targetFramework="net48" />
<package id="Syncfusion.Licensing" version="33.1.44" targetFramework="net48" />
<package id="Syncfusion.OfficeChart.Base" version="33.1.44" targetFramework="net48" />
<package id="Syncfusion.Presentation.WinForms" version="33.1.44" targetFramework="net48" />
</packages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Option Explicit
On Error Resume Next

' --- Change this input and output path as you want ---
Dim inputPath
inputPath = "D:\Template.pptx"

Dim outputPath
outputPath = "D:\Output.jpeg"

' Create the COM object exposed by your .NET class
' ProgID must match the [ProgId] attribute in your C# class
Dim obj
Set obj = CreateObject("Convert_PowerPoint_Presentation_to_Image.Class1")

If Err.Number <> 0 Then
MsgBox "Failed to create COM object 'Convert_PowerPoint_Presentation_to_Image.Class1'." & vbCrLf & _
"Error " & Err.Number & ": " & Err.Description, vbCritical, "COM Error"
WScript.Quit 1
End If

' Call the method exposed by your class
obj.ConvertPowerPointPresentationtoImage inputPath, outputPath

If Err.Number <> 0 Then
MsgBox "Method call failed (ConvertPowerPointPresentationtoImage)." & vbCrLf & _
"Error " & Err.Number & ": " & Err.Description, vbCritical, "Invoke Error"
WScript.Quit 2
End If

' Release the COM object
Set obj = Nothing

MsgBox "Success!" & vbCrLf & "Document created at:" & vbCrLf & outputPath, vbInformation, "Done"
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.14.37203.1 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Convert-PowerPoint-Presentation-to-Image", "Convert-PowerPoint-Presentation-to-Image\Convert-PowerPoint-Presentation-to-Image.csproj", "{F68DB0D1-0790-4F13-9AB5-DF895D6A6A54}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F68DB0D1-0790-4F13-9AB5-DF895D6A6A54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F68DB0D1-0790-4F13-9AB5-DF895D6A6A54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F68DB0D1-0790-4F13-9AB5-DF895D6A6A54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F68DB0D1-0790-4F13-9AB5-DF895D6A6A54}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48052932-0939-4B79-9F4B-E582DA10AD9D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Syncfusion.Drawing;
using Syncfusion.Presentation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Convert_PowerPoint_Presentation_to_Image
{
[ComVisible(true)]
[Guid("6F6B4A3C-5C98-4D63-8C7A-5B2C0F1D9E11")] // Use a unique GUID
[ProgId("Convert_PowerPoint_Presentation_to_Image.Class1")] // Stable ProgID for VBScript
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Class1
{
public void ConvertPowerPointPresentationtoImage(string inputFilePath, string outputFilePath)
{
//Open a PowerPoint Presentation.
using (IPresentation pptxDoc = Presentation.Open(inputFilePath))
{
//Converts the first slide into image.
System.Drawing.Image image = pptxDoc.Slides[0].ConvertToImage(Syncfusion.Drawing.ImageType.Metafile);
//Save the image as jpeg.
image.Save(outputFilePath);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F68DB0D1-0790-4F13-9AB5-DF895D6A6A54}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Convert_PowerPoint_Presentation_to_Image</RootNamespace>
<AssemblyName>Convert-PowerPoint-Presentation-to-Image</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Syncfusion.Compression.Base, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Compression.Base.33.1.44\lib\net462\Syncfusion.Compression.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Licensing, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Licensing.33.1.44\lib\net462\Syncfusion.Licensing.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.OfficeChart.Base, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.OfficeChart.Base.33.1.44\lib\net462\Syncfusion.OfficeChart.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Presentation.Base, Version=33.1462.44.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Presentation.WinForms.33.1.44\lib\net462\Syncfusion.Presentation.Base.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading