UseOfficeInitPowerPoint Method |
Loads MS PowerPoint® library in memory
Namespace: SautinSoftAssembly: UseOffice (in UseOffice.dll) Version: 2024.12.12
Syntax public int InitPowerPoint()
Public Function InitPowerPoint As Integer
Return Value
Int32
0 - Loading successfully
1 - Can't load MS PowerPoint® library in memory
Example How to convert a PPTX file to a PDF file in C#
using System;
using System.IO;
using System.Collections;
namespace Sample
{
class Test
{
static void Main(string[] args)
{
SautinSoft.UseOffice u = new SautinSoft.UseOffice();
string inpFile = Path.GetFullPath(@"..\..\..\..\..\..\TestFiles\example.pptx");
string outFile = Path.GetFullPath(@"Result.pdf");
int ret = u.InitPowerPoint();
if (ret == 1)
{
Console.WriteLine("Error! Can't load MS PowerPoint library in memory");
return;
}
ret = u.ConvertFile(inpFile, outFile, SautinSoft.UseOffice.eDirection.PPTX_to_PDF);
u.ClosePowerPoint();
if (ret == 0)
{
Console.WriteLine("Converting successfully!");
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
else
Console.WriteLine("Error! Please contact with SautinSoft support: support@sautinsoft.com.");
}
}
}
How to convert a PPTX file to a PDF file in VB.Net
Imports System
Imports System.IO
Imports System.Collections
Namespace Sample
Friend Class Test
Shared Sub Main(ByVal args() As String)
Dim u As New SautinSoft.UseOffice()
Dim inpFile As String = Path.GetFullPath("..\..\..\..\..\..\TestFiles\example.pptx")
Dim outFile As String = Path.GetFullPath("Result.pdf")
Dim ret As Integer = u.InitPowerPoint()
If ret = 1 Then
Console.WriteLine("Error! Can't load MS PowerPoint library in memory")
Return
End If
ret = u.ConvertFile(inpFile, outFile, SautinSoft.UseOffice.eDirection.PPTX_to_PDF)
u.ClosePowerPoint()
If ret = 0 Then
Console.WriteLine("Converting successfully!")
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
Else
Console.WriteLine("Error! Please contact with SautinSoft support: support@sautinsoft.com.")
End If
End Sub
End Class
End Namespace
See Also